this does not tell you the # of dimensions, it tells you the size of one of the dimensions.
are you asking how to know its 4d instead of 2d, or how big each piece is? The first, I do not see a way to get it. The second you can get as you show here, yes.
you are on the right track if you want to know the length of one dimension.
That would do it.
Do you know HOW it works to roll it yourself for educational purposes?! Or is it tapping something at compile time that we can't get at?
#include <bits/stdc++.h>
#include <iostream>
usingnamespace std;
int main()
{
int data[4][5][5][6];
decltype(data) x;
cout << typeid(x).name()<<endl;
}
the i is int ... so it tells you # of dimensions and size of each one all in one statment, or you can parse it out cleaner if you dislike the format. A is array, I suppose. I didnt read the docs on it, just guessing. If you want the actual value 4, you have to parse the string a little. Counting the underscores may work, at least for basic types like int. I don't know what it will spew if you have a class.
right, mine worked because the name of an array can collapse to a pointer/address.
you now have 30 lines to figure out what line 29 said.
amusing exercise, at least. I had to look it up, so I learned something as well.