
Cromwell Enage wrote:
--- John Maddock wrote:
Stjepan Rajko wrote:
So far, I've been using:
template<typename T> struct storable : public boost::remove_const<typename boost::remove_reference<T>::type > {};
[snip]
Your code will only work for class types right? If that's an acceptable limitation then it will do what you want, or did you mean:
template<typename T> struct storable { typedef typename boost::remove_const<typename boost::remove_reference<T>::type > type; };
I thought both class definitions would be equivalent from a user's perspective, e.g.:
BOOST_STATIC_ASSERT(( boost::is_same< storable<int const&>::type , int >::value ));
???? There's no nested ::type member in the first version.
I've been using the first style (the one Stjepan presented) on primitive types without problems.
Don't you end up inheriting from the primitive type in that case???? Confused yours, John.