jeudi 23 juin 2016

variadic constructor inheritance

template<typename Type, size_t Dimensions> 
struct Base 
{  
     template <typename ... Args>
    Base (const Args& ... args) : /*initialize*/ {}
/*
some functionality
*/
};

template<size_t Dimensions>
using myBase = typename Base<_DOUBLE,Dimensions> ;

template<size_t Dimensions> 
class Derived: public myBase<Dimensions> 
{
/*
some additional functionality
*/
}

myBase<2> mB(1.0,2.0); //works
Derived<2> D(1.0,2.0); //error C2661: 'Derived<2>::Derived': no overloaded function takes 2 arguments

Why the implicit inheritance of the constructor doesn't work and if it is necessary, how to create the correct constructor in this case?

Aucun commentaire:

Enregistrer un commentaire