Boost logo

Boost Users :

From: Klaus Nowikow (nowikow_at_[hidden])
Date: 2002-10-23 02:39:20


Hi!

> I'd like to have a class with a 4-D array. Initially it won't contain
> any data. However, Microsoft Visual C++ v6.0 complains about
> not finding
> a constructor.

I think the problem is, multi_array does not have a standard constructor.
You have to provide the array size at construction time.
In your example: Add a constructor

foobar::foobar()
: m_ar(boost::extents[r0][r1][r1][r3])
{ }

where r0...r3 is the maximum array size in the respective dimensions.

Cheers,

Klaus

> I want to do something like this:
>
> #include "boost/multi_array.hpp"
> typedef boost::multi_array<std::complex<double>, 4> t_Array4D;
>
> class foobar
> {
> t_Array4D ar;
> };
>
> void foobar::SetValue()
> {
> // set extents code
>
> // set value
> this->ar[0][0][0][0] = 2.0;
> }
 


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