[C++-sig] How do I make correct wrappers to interfaces while using shared_ptrs?

Adam Preble adam.preble at gmail.com
Sun Feb 5 02:23:53 CET 2012


On Sat, Feb 4, 2012 at 10:46 AM, Jim Bosch <talljimbo at gmail.com> wrote:

> If I understand your intend correctly, I think your class_ definition
> needs to be:
>
> class_<Communicable,shared_**ptr<CommunicableWrapper>,**noncopyable>
>
> (right now you have class_<CommunicableWrapper,...**>)
>
>
>
Something like this?

class_<Communicatable, boost::shared_ptr<CommunicatableWrapper>,
boost::noncopyable>("Communicatable")

I get burnt by the compiler when I try that:

d:\coding\boost_1_47_0\boost\python\object\pointer_holder.hpp(217): error
C2664: 'CommunicatableWrapper::CommunicatableWrapper(const
CommunicatableWrapper &)' : cannot convert parameter 1 from 'PyObject *' to
'const CommunicatableWrapper &'
          Reason: cannot convert from 'PyObject *' to 'const
CommunicatableWrapper'
          No constructor could take the source type, or constructor
overload resolution was ambiguous

It sounds like if I had a constructor that would take a PyObject *, that
would shut it up, but I have no idea what to make of such a thing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20120204/4dfdc62e/attachment.html>


More information about the Cplusplus-sig mailing list