خرید بک لینک

Vote count: 0

I am using a boost::multi_array to store some data. I do all my work on the data using views, because I need to work with slices of the data in different dimensions.

My question is, how is the memory of boost::multi_array managed?

In particular, I would like to work with a copy of a slice (view) of my data. Therefore I would like to do something like this:

typedef boost::multi_array<double, 2> MyContainer;
typedef MyContainer::array_view<1>::type Slice1D;

Slice1D copy(const Slice1D & slice)
{
    MyContainer copyMemory(slice);
    Slice1D sliceCopy = copyMemory[boost::indices[0][range()]];
    retu sliceCopy;
}

void main()
{
    ...
    Slice1D copySlice = copy(mySlice);
}

I would like to know whether this is wrong because the multi_array containing the copy goes out of scope when the copy function retus. Or is it OK because multi_array uses smart pointers or reference counting to keep track?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 21 فروردين 1395 ساعت: 22:45

صفحه بندی