Image

Imagenutritioustreat wrote in Imagecpp

msvc6 vs. g++ template problem

msvc6 allows the following code:
template<typename t_interface, typename t_impl = t_interface::impl_default>
class CImpl
{
      ...
};

where t_interface::impl_default is a typedef, like:
class ITest
{
       public: typedef class CTest impl_default;
       public: typedef class CTestOther impl_other;

       ...
};

(so an instantiation might look like one of:)
    CImpl<ITest, CTest>  Default;
    CImpl<ITest>  DefaultAgain;
    CImpl<ITest, ITest::impl_default>  DefaultYetAgain;
    CImpl<ITest, ITest::impl_other> Other;

however, g++ doesn't like "typename t_impl = t_interface::impl_default". it doesn't seem to let me "access" the typedef in t_interface in the template declaration. is there any way to get what i want in a portable manner? (allow CImpl to access something scoped inside t_interface in the default declaration of t_impl?)