I want const_value_type be const, even if T is a pointer, which is not possible when using std::add_const<>
So I tried something like this:
template<typename value_type, bool is_pointer> struct add_const_pointer{ typedef const value_type type; }; template<typename value_type> struct add_const_pointer<value_type, true>{ typedef const value_type *type; }; template<typename T> class Foo { public: typedef T value_type; typedef add_const_pointer<std::remove_pointer<T>, std::is_pointer<T>::value>::type const_value_type;
but I get a compiler error: missing type specifier - int is assumed.
Quest source share