Jason Spencer: > Do you mean just the number of dimensions, or do you mean the size > along each dimension?
I mean just the number of dimensions. > Knowing just the # of dimensions won't tell me > the total size or how to index. I need the size of each dimension. If you need that information at compile-time then it's better to just use nD fixed-sized arrays. There is not much need to create an array struct for this purpose. > That's a copy from heap to stack, isn't it? Right. (and that code isn't fully syntactically correct, you need to use [] when you copy array contents). > That's what I'm trying to avoid.< D doesn't support fixed-sized arrays allocated on the heap, to do that you need to wrap them inside a struct (with no waste of extra memory): struct Foo(int N) { int[N] arr; } void main() { Foo!5* f = new Foo!(5)(); static assert((Foo!(5)).sizeof == 5 * int.sizeof); } Bye, bearophile