Boost logo

Boost Users :

Subject: Re: [Boost-users] multi_array_ref (lack of) default constructor
From: gtsml owevwr (gtsml.owevwr_at_[hidden])
Date: 2009-06-01 05:04:55


Multi_array view has not default constructor, so I'm stuck with the
same problem.

I guess in the end this is a matter of taste. multi_array seems to be
designed so that objects are always valid at all time.
I'm sure it has lots of advantages, still, for lightweight object such
as a view or multi_array_ref, that might not be necessary.

Ok, I think the only solution left is to use pointers to
multi_array_ref, that should work.
I'd be able to do something along that line (not tested):

std::vector<int> memoryChunk0;
std::vector<int> memoryChunk1;

{
        std::vector<multi_array_ref*> v;
        v.push_back(new multi_array_ref( <ctor from memoryChunk0 > ));
        v.push_back(new multi_array_ref( <ctor from memoryChunk1 >));

        myFunction(v);

        BOOST_FOREACH( multi_array_ref* ma, v)
        {
          delete ma;
        }
}


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