I receive a matrix with elements of type unsigned char from another function and I am trying to find its max value.
boost::multi_array<unsigned char, 2> matrix;
All elements are integers and so I was hoping to recast matrix as type <int, 2> then perform std::max_element() operation, but unsure how to recast type of a boost multi array.
You don't need that to use
max_element.charis an integral type just likeint:Live On Compiler Explorer
Program stdout
Reinterpreting View
If you must (for other reasons thatn using
max_element) you can use amulti_array_ref:Which prints Live On Compiler Explorer
You can also reshape it:
Printing