boost::shared_ptr<const T> to boost::shared_ptr<T>
- by Flevine
I want to cast the const-ness out of a boost::shared_ptr, but I boost::const_pointer_cast is not the answer. boost::const_pointer_cast wants a const boost::shared_ptr, not a boost::shared_ptr. Let's forego the obligitory 'you shouldn't be doing that'. I know... but I need to do it... so what's the best/easiest way to do it?
For clarity sake:
boost::shared_ptr<const T> orig_ptr( new T() );
boost::shared_ptr<T> new_ptr = magic_incantation(orig_ptr);
I need to know the magic_incantation()
Thanks!