Bilokon, Paul | 11 May 23:45

Exposing C++ Functions with Container Arguments in Boost.Python


[This question is about Boost.Python. If there is a more approprate
mailing list to send it to, please do let me know.]

Hi all,

This is probably a trivial question, but after some research I was
unable to find a "best practice" answer, so my sincere apologies.

I am trying to expose a C++ function which takes an std::vector<double>
as its argument, some

void A::foo(std::vector<double> v);

And perhaps

void A::bar(std::vector<double> & v);

Whether it is a good practice to have such arguments is, of course, open
to debate (shouldn't they be iterators?), but this is what I have to
work with.

The question remains, what is the best way to expose these to python? I
cannot pass a Python list -- it's a type mismatch.

Many thanks!

Regards,
Paul
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Continue reading)

Sohail Somani | 12 May 01:11

Re: Exposing C++ Functions with Container Arguments in Boost.Python

Bilokon, Paul wrote:
> [This question is about Boost.Python. If there is a more approprate
> mailing list to send it to, please do let me know.]

I believe there is a Boost Python list somewhere.

> I am trying to expose a C++ function which takes an std::vector<double>
> as its argument, some

http://viral.media.mit.edu/peers/doc/d559896225ab075fb7cb21f54cad008959c1d095.html

Should get you started. I believe you have to register each type but it 
escapes me how you do that. :-)

--

-- 
Sohail Somani
http://uint32t.blogspot.com

Gmane