C++ class template specialization for given template class -


i try implement template class , want restrict specialized given template class. example, in following codes, want define template class ctest specialized std::vector<t> template parameter t. other template parameters, class should undefined. how implement template class?

//   interface should following //template <typename std::vector<t> > //class ctest<std::vector<t> >;  int main(int argc, char* argv[]) {     ctest<std::vector<int> > t1;    //  successful      ctest<std::vector<string> > t1; //  successful      ctest<int> t2;                  //  compile error     return 0; } 

leave primary template undefined , partially-specialize types want admit:

template <typename> class ctest;  // undefined   #include <vector>  template <typename t, typename alloc> class ctest<std::vector<t, alloc>> {     // ... template here ... }; 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -