Boost logo

Boost Users :

Subject: [Boost-users] Storing path from A*, using operator::new with boost::multi_array
From: Sladey (sladehboi_at_[hidden])
Date: 2013-07-31 10:10:38


I'm trying to use dynamic memory allocation for the first time. I want to
allocate memory for a 2 dim dynamic array, to store paths from an A*
function. I think the array for the job is boost::multi_array.

Problem I have is seem to be able to allocate the memory but i can't change
or access any of the elements.

#include <iostream>
#include "boost/multi_array.hpp"

typedef boost::multi_array<int, 2> array_type;

int main()
{
    array_type *A = new array_type;

    A->resize( boost::extents[2][2] );

    A[1][1] = 2;

    std::cout << A[1][1] << std::endl;

    delete A;

    return 0;
}

--
View this message in context: http://boost.2283326.n4.nabble.com/Storing-path-from-A-using-operator-new-with-boost-multi-array-tp4650141.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net