Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - method template specialization in class templates and virtual method templates
template<typename tt,typename tt2> class template_test { public: tt member; template <typename mtt> mtt tmethod(mtt p) { tt tmp; return p; } /* omitting the specialization no test.cpp(19) : Error: 'tmethod' is not a class template error template <> tt2 tmethod<char>(char p) { tt2 tmp return tmp; } template <> long tmethod<int>(int p) { return 2; } */ operator tt() { return member; } template <typename vmtt> virtual vmtt vtmethod(vmtt p) //line 26 { return p; } }; template_test<template_test<int,double>,char> otempl; dmc -Ae test.cpp test.cpp(19) : Error: 'tmethod' is not a class template Internal error: template 1714 --- errorlevel 1 dmc -Ae test.cpp test.cpp(26) : Error: storage class is illegal in this context --- errorlevel 1 the c++ standard permit this things??? dmc will support??? thx in advice Sep 07 2003
Virtual template methods are disallowed by the C++ spec. Sorry, -Walter "Michele" <noways aliceposta.it> wrote in message news:bjfg52$1md$1 digitaldaemon.com...template<typename tt,typename tt2> class template_test { public: tt member; template <typename mtt> mtt tmethod(mtt p) { tt tmp; return p; } /* omitting the specialization no test.cpp(19) : Error: 'tmethod' is not a class template error template <> tt2 tmethod<char>(char p) { tt2 tmp return tmp; } template <> long tmethod<int>(int p) { return 2; } */ operator tt() { return member; } template <typename vmtt> virtual vmtt vtmethod(vmtt p) //line 26 { return p; } }; template_test<template_test<int,double>,char> otempl; dmc -Ae test.cpp test.cpp(19) : Error: 'tmethod' is not a class template Internal error: template 1714 --- errorlevel 1 dmc -Ae test.cpp test.cpp(26) : Error: storage class is illegal in this context --- errorlevel 1 the c++ standard permit this things??? dmc will support??? thx in advice Sep 07 2003
|