Finding the amount of rows and columns for a 2-D array in C++
In C++11 you can do this using template argument deduction. It seems that the extent
type_trait
already exists for this purpose:
#include <type_traits>
// ...
int rows = std::extent<decltype(array), 0>::value;
int cols = std::extent<decltype(array), 1>::value;