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

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -