Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby, SWIG and C++: how to properly wrap vector of vectors of doubles (2D vectors)?

Thread Tools

Ruby, SWIG and C++: how to properly wrap vector of vectors of doubles (2D vectors)?

Posts: n/a
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi All,
I am succesfully using SWIG generated wreppers to export my C++ library to =
In my C++ library I extensively use nested C++ vectors like:

typedef std::vector<double> DblVtr; //1D-vector (vector of doubles)
typedef std::vector<DblVtr> DblVtr2; //2D-vector (vector of vectors of doub=

When using SWIG genereted wrappers, I cannot figure out how to initialize
2D-vector from 2D Ruby arrays.

v1=3D3D [1.0, 2.0] # works fine
v2=3D3D [v1, v1] # works fine

v3=3D3D [[1.0, 2.0], [1.0, 2.0]] # does NOT work!

What is the PROPER way of building nested containers when dealing with
SWIG and Ruby??
Any help is highly appreciated.



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
c++ primer statement about vectors containing vectors C++ 3 03-26-2008 06:22 PM
Free memory allocate by a STL vector, vector of vector, map of vector C++ 8 02-18-2006 12:48 AM
vector of vector of vectors Creighton Hogg C++ 4 01-21-2006 05:11 AM
floats doubles long doubles dan C++ 1 11-26-2003 05:12 AM