Newbie trying to use multi_array ...
I'm new to Boost, so please excuse my lack of knowledge. I'm trying to use the multi_array class and have hit a small snag. 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 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; }
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; }
participants (2)
-
Jon Pendergrass
-
Klaus Nowikow