Specjalizacja szablonu

0

Witam,
Mam problem, gdyż mój kompilator wskazuje na brak dopasowania poszczególnych specjalizacji szablonu podczas konkretyzacji. Wskazuje, że jest nieodpowiednia liczba argumentów pomimo iż dla danej ilości parametrów jest napisany specjalny kod.
Proszę o pomoc!

 template<typename T1, typename T2, typename T3,typename T4>
struct Tuple : Tuple<T2, T3, T4>
{
    T1 x;

    using Base = Tuple<T2, T3, T4>;
    Base* base() {return static_cast<Base*>(this);}
    const Base* base() {return static_cast<const Base*>(this);}

    Tuple(const T1& t1,const T2& t2,const T3& t3,const T4& t4):Base(t2,t3,t4), x(t1)    {}

};


template<>
struct Tuple<>  {Tuple() {}};

template<typename T1>
struct Tuple<T1> : Tuple<>
{
    T1 x;

    using Base = Tuple<>;
    Base* base() {return static_cast<Base*>(this);}
    const Base* base() {return static_cast<const Base*>(this);}

   Tuple(const T1& t1):Base{}, x{t1}    {}

};



template<typename T1, typename T2>
struct Tuple<T1, T2> : Tuple<T2>
{
    T1 x;

    using Base = Tuple<T2>;
    Base* base() {return static_cast<Base*>(this);}
    const Base* base() {return static_cast<const Base*>(this);}

    Tuple(const T1& t1,const T2& t2):Base(t2), x(t1)    {}
};


template<typename T1, typename T2, typename T3>
struct Tuple : Tuple<T2, T3>
{
    T1 x;

    using Base = Tuple<T2, T3>;
    Base* base() {return static_cast<Base*>(this);}
    const Base* base() {return static_cast<const Base*>(this);}

    Tuple(const T1& t1,const T2& t2,const T3& t3):Base(t2,t3), x(t1)    {}

};

1
  1. <font size="9">D</span>on't <font size="9">R</span>epeat <font size="9">Y</span>ourself<

  2. varadic template
  3. std::tuple
0

Dobra dzięki,
Odpowiedź na to pytanie została udzielona pośrednio, chodzi tu o VARADIC TEMPLATES.
Sam już doczytałem o szczegółach.

1 użytkowników online, w tym zalogowanych: 0, gości: 1