Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-02-09 13:28:37


From: <pplumlee_at_[hidden]>
> "David Abrahams" <abrahams_at_m...> wrote:
>
> > > Try this experiment. Take 'example1.cpp' from the (excellent)
> Boost Python
> > > Library. It's got a class called hello::world or some such. Now
> add to it
> > > this class:
> > >
> > > world *getAnotherWorld () { return new world (1); }
> > >
> > > Leave aside for a moment the usual fretting about leaky
> interfaces, and
> > add a
> > > 'def' to describe that method:
> > >
> > > ... world.def (&hello::world::getAnotherWorld, "getAnotherWorld");
> > >
> > > Now try to compile. The compile bombs deep in the nested templates
> that
> > are
> > > trait-ing out the method pointer
> > >
> > > Am I missing something? Do I have to pre-wrap that 'world' in an
> adapter,
> > or
> > > do I add a trait for it, or what?
> >
> > Just return a std::auto_ptr<world> or a boost::shared_ptr<world>.
> You need
> > to give Python reason to believe it can take ownership of this
> pointer.
>
> How do I do a None? When I pack NULL in that boost::shared_ptr<> the
> python croaks with a BPL-generated conversion error.
>
> --Phlip

What is NULL defined as on your system? ((void*)0) ?

What is the error you are seeing?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk