How would I find the size in bytes of an array like this?
double dArray[2][5][3][4];
I've tried this method but it returns "2". Maybe because the array is only declared and not filled with anything?
#include <iostream>
#define ARRAY_SIZE(array) (sizeof((array))/sizeof((array[0])))
using namespace std;
int main() {
double dArray[2][5][3][4];
cout << ARRAY_SIZE(dArray) << endl;
}
template<class T> constexpr std::size_t get_element_count(T const& a) { return sizeof(T)/sizeof(typename std::remove_all_extents<T>::type); }