The following compilations are with VC2010, but not with gcc 4.5.1 with -std = C ++ 0x:
template <class T, class TBase>
class TestBase : public TBase
{
public:
template <unsigned int t_u, class TRet = int>
struct Helper
{
TRet operator() (int x = 0, int y = 0)
{
return (TRet)t_u;
}
};
};
template<class TBase>
class Test0 : public TestBase<Test0<TBase>, TBase>
{
public:
Helper<100> Get100;
};
gcc accepts a more detailed description:
template<class TBase>
class Test1 : public TestBase<Test1<TBase>, TBase>
{
typedef TestBase<Test1<TBase>, TBase> thisBase;
public:
typename thisBase::template Helper<100> Get100;
};
Which (if any) is C ++ 0x compatible?
source
share