c++ template question:# Programming - 葵花宝典
F*i
1 楼
trying a sample code from template complete:
template
class IsClassT {
private:
typedef char One;
typedef struct { char a[2]; } Two;
template static One test(int C::*);
template static Two test((B!DB);
public:
enum { Yes = sizeof(IsClassT::test(0)) == 1 }; //ERROR LINE
enum { No = !Yes };
};
It is supposed to work from the book, however, the g++ complains as:
line 21: error: expected primary-expression before '>' token
do not
template
class IsClassT {
private:
typedef char One;
typedef struct { char a[2]; } Two;
template
template
public:
enum { Yes = sizeof(IsClassT
enum { No = !Yes };
};
It is supposed to work from the book, however, the g++ complains as:
line 21: error: expected primary-expression before '>' token
do not