Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-25 12:09:15


Why not just wrap std::vector<long> and provide the appropriate sequence
operations?

boost/libs/python/example/simple_vector.cpp has an example.

Ralf, it looks to me like getitem() in this example should use at() or some
other way of raising an IndexError when the index is out-of-range.
Otherwise, you won't be able to write "for x in v:" without the program
crashing(!).

-Dave

----- Original Message -----
From: <rcspython_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, April 25, 2001 11:43 AM
Subject: [boost] BPL: Easiest way to return a private vector<long> ?

> I have a C++ class that has a member
>
> private
> std::vector<long> m_vector;
>
> public
> const std::vector<long> GetVector(void) {return m_vector;};
> To export the value....
>
> My first instinct was to use boost::python::tuple as the return type
> in the wrapper.... but after browsing the objects.hpp file it seems
> that I have to have either 1,2,3, or 4 elements in m return tuple?
>
> What is the easiest way to do this if the const boost::python::tuple
> won't work?
>
> Best Regards!
>
> Ron
>
>
> To unsubscribe, send email to: <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