[C++-sig] return boost::shared_ptr<some internal>

Neal Becker ndbecker2 at gmail.com
Fri Jun 14 13:57:48 CEST 2013


I have a class that has a member

something like this:

class A {
  boost::shared_ptr<B> b;

};

boost::shared_ptr<B> get_b (A const& ...) {
  return A.b;
}

where class B is already exposed to python in a different module.


I tried to provide access to the internal member A.b:

class_<A> ...
  .add_property ("b", &A::get_b)


It seems that attempting to provide access to this internal member fails, with
a message about no conversion from c++ type blah blah.

The c++ type represented by this internal state is already exposed in a 
different python module, which has also been imported into python.

>From what I can gather from ancient messages on the web, this usage just isn't
going to work.

Any thoughts?



More information about the Cplusplus-sig mailing list