c++ - Multiple template types -
is possible have multiple template types in c++?
for example;
template<template<typename> class baseclass> class myclass {}; template<class baseclass> class myclass {};
and using it;
// using first template (template<typename> class baseclass) template<typename subclass> class myfirstsubclass : public myclass<myfirstsubclass> {}; // using second template (class baseclass) class mysecondsubclass : public myclass<mysecondsubclass> {};
you can't have separate templates same name, can have base template , 1 or more specializations of class.
template<class baseclass> class myclass { }; template<class t, template<typename> class baseclass> class myclass<baseclass<t>> { }; template<> class myclass<int> { };
Comments
Post a Comment