P
PengYu.UT
For example, I want the return_type of the two arguments of Expr2 be
the same. Otherwise, the compilor should give an error.
Would you please tell me how to do that?
Thanks,
Peng
template <typename T>
struct Expr1{
typedef T return_type;
};
template <typename E, typename T>
struct Expr2;
template <typename E1, typename E2>
struct Expr2 {//I want E1 and E2's return_type be the same.
typedef typename E1::return_type return_type;
};
int main(int argc, char *argv[]){
Expr2<Expr1<int>, Expr1<double> > a;
}
the same. Otherwise, the compilor should give an error.
Would you please tell me how to do that?
Thanks,
Peng
template <typename T>
struct Expr1{
typedef T return_type;
};
template <typename E, typename T>
struct Expr2;
template <typename E1, typename E2>
struct Expr2 {//I want E1 and E2's return_type be the same.
typedef typename E1::return_type return_type;
};
int main(int argc, char *argv[]){
Expr2<Expr1<int>, Expr1<double> > a;
}