Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-07-09 18:26:36


Actually, I think this would be easier:

this_module.add(boost::python::make_ref(TAB), "TAB");

That works, doesn't it?
-Dave

----- Original Message -----
From: <Peter.Bienstman_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, July 09, 2001 10:01 AM
Subject: [boost] Re: enums in boost.python documentation incorrect

> Actually, after some experimenting and looking through the source it
> turns out that the correct way to add enums to modules is to use
>
> this_module.add(ref(boost::python::to_python(TAB)), "TAB");
>
> rather than
>
> this_module.add( boost::python::to_python(TAB) , "TAB");
>
> It would be very useful if the documentation were updated.
>
> Cheers,
>
> Peter Bienstman
>
> --- In boost_at_y..., "David Abrahams" <abrahams_at_m...> wrote:
> > Hmm, possibly another doc bug.
> > I'll look into it, thanks. In the meantime, the following is used
> in the
> > comprehensive tests:
> >
> > m.add(PyInt_FromLong(one), "one");
> > m.add(PyInt_FromLong(two), "two");
> >
> > -Dave
> > ----- Original Message -----
> > From: "Eric van Riet Paap" <eric_at_q...>
> > To: <boost_at_y...>
> > Sent: Monday, March 19, 2001 6:26 PM
> > Subject: [boost] enums in boost.python documentation incorrect
> >
> >
> > I've just posted this:
> >
> > ---------
> >
> > enum KEY
> > {
> > TAB =8,
> > CR =10,
> > ESCAPE =27,
> > SPACE =32,
> > };
> >
> > boost::python::enum_as_int_converters<KEY> thekeys;
> >
> > this_module.add(boost::python::to_python(TAB), "TAB");
> >
> > --------
> >
> > However, because the last line gives compile errors I tried:
> >
> > vr.add(boost::python::ref(boost::python::to_python(TAB)), "TAB");
> >
> > And that seems to work. But since it is written incorrent in the
> > documentation I am not sure if this is the correct way.
> > Please enlighten me!
> >
> > Eric
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


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