
Anyway, I'd like to point out that the member_object.hpp header linked to by John Maddock is not actually what the tracking ticket he also linked to was asking for. It seems pretty clear to me that whoever posted that wanted something more like this:
template<class T> struct remove_mem_ptr { typedef T type; }; template<class T, class In> struct remove_mem_ptr<T In::*> { typedef T type; };
template<class T, class In> struct add_mem_ptr { typedef T In::*type; }; // (for completeness...)
(Evidence: the person who posted that ticket said this:
Can boost::remove_pointer<T> be modified to work with pointers-to-member (data), too? For instance: remove_pointer<int *> returns the int type, but so should remove_pointer<int std::div_t::*>. ...implying that he wants remove_pointer<int std::div_t::*> to return int, not std::div_t. And member_object<int std::div_t::*> would return std::div_t.)
Not quite, there was some discussion on the mailing list about that feature request (including with the OP) and there was a clear consensus for *not* modifying remove_pointer, but for adding a new trait (which the OP was happy with as far as I recall). The reason for not using the "obvious simple implementation" BTW is two fold: * It doesn't work for all compilers. * It doesn't handle compiler extensions like __fastcall etc. HTH, John.