[C++-sig] [Boost.Python] shared_ptr<const T>

Kirill Lapshin kir at lapshin.net
Mon Nov 20 11:32:08 CET 2006


Not sure if that is the right solution, but I am tackling this problem 
in a following way:

namespace boost{ namespace python{

template <class T> inline T* get_pointer( boost::shared_ptr<const T> 
const& p){
     return const_cast<T*>(p.get());
}

template <class T> struct pintee< boost::shared_ptr<const T> >{
     typedef T type;
};
}}

and later on

boost::python::register_ptr_to_python< boost::shared_ptr<const my_class> 
 >();

Looks more like workaround to me, so if anyone can propose better 
solution, I am all ears.


Charles Flèche wrote:
> That kind of question has already been posted a few month ago, and had
> no answer. I'd like to know if it's because it's a 100% newbie question
> and you are tired of answer that (if so, please point me to the FAQ so I
> could RTFM), or if there is a real technical problem behind that.
> 
> Thank you a lot !
> 




More information about the Cplusplus-sig mailing list