Boost logo

Boost Users :

Subject: Re: [Boost-users] [multi_array] pointer type - does not compile
From: Stefan van Kessel (van_kessel_at_[hidden])
Date: 2010-09-21 03:22:26


On 9/21/2010 12:46 AM, Suresh Kumar wrote:
> The following code does not compile.
>
> #include <boost/multi_array.hpp>
> #include <iostream>
>
> int
> main () {
>
> typedef boost::multi_array<int, 3> array_type;
> typedef array_type::index index;
> array_type * A;
> A = new array_type(boost::extents[3][4][2]);
> array_type::extent_gen extents;
>
> A[0][0][0] =1;
> return 0;
> }

You forgot to dereference A:
(*A)[0][0][0] = 1;

Have a nice day,
Stefan


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