I'm wondering a simple way to find the maximum/minimum element of a boost multiarray, an object of 3 indices as the following:
int iDepth=10,iWidth=10,iHeight=10;
boost::multi_array<GLfloat, 3> image(boost::extents[iDepth][iWidth][iHeight]);
I'm wondering a simple way to find the maximum/minimum element of a boost multiarray, an object of 3 indices as the following:
int iDepth=10,iWidth=10,iHeight=10;
boost::multi_array<GLfloat, 3> image(boost::extents[iDepth][iWidth][iHeight]);
 
    
    This should work :
std::max_element( image.origin(), image.origin() + image.num_elements());
 
    
    Using member data() is more correct because:
image is actually a contiguous (compact array).[0][0].... (origin() means the address of [0][0]... even if the array "starts" at a different point, e.g. [1][1]....std::max_element( image.data(), image.data() + image.num_elements());
 
    
    Did you try something like:
std::max_element( image.begin(), image.end());
