
On Jun 30, 2008, at 9:46 AM, Joey Mukherjee wrote:
On Jun 27, 2008, at 11:16 AM, Ronald Garcia wrote:
On Jun 26, 2008, at 2:43 PM, Joey Mukherjee wrote:
Suppose this type of setup was within a function, is it possible to make OneDView the return value of this function? In other words, I would like to:
array_type::const_array_view <1>::type OneDView; OneDView = multi_array[myindices]; return OneDView;
Off-hand, I see no reason why you couldn't do this. So long as the multi_array is still in existence, you can build and keep a view of it. How are you calling your function? I'm afraid I can't tell what the problem might be since I can't see how it's really used.
What would be the return value of the function? In other words, what would the function prototype be? As in the code above, I am not allowed to assign to a OneDView. How can I write it so that I am able to?
Rather than assign to a OneDView, you can construct a OneDView as the
result of a function call:
typedef boost::multi_array
The way I have my function, I am calling it like so:
double GetRealData (const SensorInfo &si, const std::vector <double> &vals, const unsigned int whichPosition)
The vals is a n-dimensional array of doubles and the si variable has the desired slice and the sizes of my array. Rather than return a double, I would like to return a one-dimensional const_array_view.
If you don't know at compile-time how many dimensions your array is, then I think that you will need to copy the view into a one- dimensional multi_array.
Thanks for your help!
Joey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users