I'm trying to control the constness of some pointer type based on the constness of some template parameter type using boost::mpl. Here's my attempt:
template<typename T>
struct iter {
typedef typename boost::mpl::if_<boost::is_same<T, const list>, const sexpr *, sexpr *>::type pointer;
};
The compiler however rejects this saying:
sexpr.h:154: error: ISO C++ forbids declaration of `type name' with no type
sexpr.h:154: error: template argument 2 is invalid
sexpr.h:154: error: template argument 1 is invalid
sexpr.h:154: error: `type' does not name a type
Any clue what I'm doing wrong?
Thanks!
I was able to fix it using is_const:
typedef typename boost::mpl::if_<boost::is_const<T>, const sexpr *, sexpr *>::type pointer;
Thanks!