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?
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.
Thanks for your help!
Joey