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

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


----- 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

Boost list run by bdawes at, gregod at, cpdaniel at, john at