[C++-sig] Boost Python - How to export boost::shared_ptr<std::string>
roman.yakovenko at gmail.com
Tue Dec 15 09:01:01 CET 2009
On Tue, Dec 15, 2009 at 9:36 AM, Romain CHANU <romainchanu at gmail.com> wrote:
> I want to export an attribute which is a boost::shared_ptr<std::string> and
> I got the following error:
> " TypeError: No Python class registered for C++ class class
> boost::shared_ptr<class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > > "
> I found an old post on a similar issue :
> but no one has replied :-\
> Can anyone tell me how can I export this type?
If I were you, I would not export it. In any case Python strings are
immutable and you always returns a copy of the string.
Instead of exposing that attribute directly create a get/set functions
which use "raw" "std::string" in their interface and expose them.
May be "custom converter" could help you (
), but I never tried it on such use case.
C++ Python language binding
More information about the Cplusplus-sig