Boost :: shared_ptr <const T> for boost :: shared_ptr <T>
I want to infer const-ness from boost::shared_ptr , but I boost::const_pointer_cast not the answer. boost::const_pointer_cast wants a const boost::shared_ptr<T> , not boost::shared_ptr<const T> . Let me give up the obligatory "you must not do this." I know ... but I need to do this ... so what's the best / easiest way to do this?
For clarity:
boost::shared_ptr<const T> orig_ptr( new T() ); boost::shared_ptr<T> new_ptr = magic_incantation(orig_ptr); I need to know magic_incantation ()
+4
2 answers