Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-02-08 23:30:18


----- Original Message -----
From: "Phlip" <pplumlee_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, February 08, 2001 11:09 PM
Subject: [boost] Detachable objects in BPL

> Boosters:
>
> 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.

> On a related note, because Boost documentation does not appear to have any
> class-by-class references, and if y'all are considering writing a book,
might
> one suggest y'all comment all the classes, run them thru Doxygen, and
publish
> that?

This is a failing of BPL specifically, and one I intend to address when I
get a few days...
The other boost libraries are much better in this regard.

-Dave


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