These days, one can use std::array, the size function returns the number of elements in the array.
Although this is rather silly, because the array size is still a compile time constant, so one should know what it is any way. The other functions available for std::array could be handy though.
There is such a function as std::extent in C++. You can use it to determine the size of an array. But in any case it will not give you the size of a dynamically allocated array.
For example
int a[2][4][6];
std::cout << std::extent<decltype( a )>::value << std::endl;
std::cout << std::extent<decltype( a ), 1>::value << std::endl;
std::cout << std::extent<decltype( a ), 2>::value << std::endl;
std::cout << std::endl;