KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
suppose you have the code template <template<class> class BaseType> class EST16 : public BaseType<int> { public: EST16(double d) { } }; template <class T> class SCEST { T y; }; typedef EST16<SCEST> EST16_SC; class Child : public EST16_SC { public: Child() : EST16_SC(1.0) { } }; class NotWorkingChild : public EST16<SCEST> { public: NotWorkingChild() : EST16<SCEST>(1.0) { } }; TEST(TemplateTest, TestInstantiate) { Child child; NotWorkingChild notWorkingChild; } Child and NotWorkingChild differ only by the typedef. In GCC both compile, in Visual Studio the constructor of NotWorkingChild produces the following error: 2>..\..\..\src\itenav\test\SCKFErrorStateTest.cpp(43) : error C3200: 'SCEST<T>' : invalid template argument for template parameter 'BaseType', expected a class template 2> with 2> [ 2> T=int 2> ] Can you explain why this is the case? Is there a better portable solution than the typedef? Thanks!
Tags (comma-separated)
Save Edits
Cancel