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

Discussion in 'Ruby' started by Guest, Sep 14, 2005.

  1. Guest

    Guest 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--
    Guest, Sep 14, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dan
    Replies:
    1
    Views:
    2,304
    Jack Klein
    Nov 26, 2003
  2. Replies:
    8
    Views:
    1,896
    Csaba
    Feb 18, 2006
  3. Aaron Fude

    To wrap or not to wrap?

    Aaron Fude, May 8, 2008, in forum: Java
    Replies:
    12
    Views:
    686
    Chronic Philharmonic
    May 10, 2008
  4. Art Werschulz

    Text::Wrap::wrap difference

    Art Werschulz, Sep 22, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    221
    Art Werschulz
    Sep 22, 2003
  5. Art Werschulz

    Text::Wrap::wrap difference

    Art Werschulz, Sep 24, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    233
    Anno Siegel
    Sep 25, 2003
Loading...

Share This Page