Boost logo

Boost Users :

Subject: Re: [Boost-users] Storing path from A*, using operator::new with boost::multi_array
From: Dan Searles (dansearles_at_[hidden])
Date: 2013-08-01 10:05:08


Sladey wrote
> 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&lt;int, 2&gt; 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;
> }

Try: (*A)[1][1] = 2;
and
std::cout << (*A)[1][1] << std::endl;

Dan Searles

--
View this message in context: http://boost.2283326.n4.nabble.com/Storing-path-from-A-using-operator-new-with-boost-multi-array-tp4650141p4650178.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