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

G

Guest

------=_Part_3942_18680883.1126720031081
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 =
Ruby.
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=
les)

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

v1=3D3D DblVtr.new [1.0, 2.0] # works fine
v2=3D3D DblVtr2.new [v1, v1] # works fine

v3=3D3D Dbl2.new [[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.

Thanks,
--Leo--

------=_Part_3942_18680883.1126720031081--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top