CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    5

    Boost multy_array gives an runtime error

    Hi guys, i am a beginer in C++, i am developing a Managed C++ wrapper for an existing native C++ dll. The native C++ dll uses std:: pair<unsigned long, boost::multi_array<double,2>> as input.I tried creating a multiarray object and got the error when i tried assigining it to "second" property of pair object. Please help. I have put the code below.

    "Assertion Failed!"
    multi_array_ref.hpp:487:
    `std::equal(other.shape(),other.shape()+this->num_dimensions(),
    this->shape())'



    std:: pair<unsigned long, boost::multi_array<double,2>> dataPointNative;
    dataPointNative.first = 100;
    KWExtrinsicModuleStructures::Matrix^ rMatrix = dpt->Value;
    boost::multi_array<double,2> rachetmatrix(boost::extents[3][3]);
    for(int i=0;i<rMatrix->Rows;i++)
    {
    for(int j=0;j<rMatrix->Columns;j++)
    {
    rachetmatrix[i][j] = 3.1417;

    }
    }
    dataPointNative.second = rachetmatrix; //Line where i get the error.

    Thanks in Advance.
    Naresh

  2. #2
    Join Date
    Apr 2008
    Posts
    725

    Re: Boost multy_array gives an runtime error

    I think you get the error because dataPointNative.second isnt the same dimension as [3][3].

    try

    Code:
    dataPointNative.second.resize(boost::extents[3][3]);
    dataPointNative.second = rachetmatrix;

  3. #3
    Join Date
    Mar 2011
    Posts
    5

    Re: Boost multy_array gives an runtime error

    Bingo! Thank you very much.That was the issue. Saved my day.

    Naresh

  4. #4
    Join Date
    Apr 2008
    Posts
    725

    Re: Boost multy_array gives an runtime error

    No probs.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured