How to get max / min element from multiarray

I am interested in a simple way to find the maximum / minimum element of a multi-level boost, an object of 3 indices in the following form:

int iDepth=10,iWidth=10,iHeight=10; boost::multi_array<GLfloat, 3> image(boost::extents[iDepth][iWidth][iHeight]); 
+4
source share
2 answers

This should work:

 std::max_element( image.origin(), image.origin() + image.num_elements()); 
+1
source

You tried something like:

 std::max_element( image.begin(), image.end()); 
-1
source

Source: https://habr.com/ru/post/1487226/


All Articles