
Ion GaztaƱaga wrote: [...]
My question is, do you find this mechanism useful to include it in boost in a general way, and if so, is there another way of doing this without modifying existing classes (for example, if I want use these mechanism with shared_ptr)?
template< class P, class V > struct pointer_to_other; template< template<class> class P, class U, class V > struct pointer_to_other< P<U>, V > { typedef P<V> type; }; #include <boost/shared_ptr.hpp> #include <typeinfo> #include <iostream> int main() { typedef pointer_to_other< boost::shared_ptr<int>, double >::type pointer; std::cout << typeid(pointer).name() << std::endl; } On compilers that can't handle the above, just add partial specializations for "well known" pointer types (auto_ptr, shared_ptr).