easier way?
Jason Spencer
spencer8 at sbcglobal.net
Wed Aug 25 18:09:50 PDT 2010
== Quote from bearophile (bearophileHUGS at lycos.com)'s article
> I suggest you to create a templated struct where the template
arguments are the element type and the number of dimensions.
Do you mean just the number of dimensions, or do you mean the size
along each dimension? Knowing just the # of dimensions won't tell me
the total size or how to index. I need the size of each dimension.
I'm starting to think a variadic template might be workable...
> > I can never cast a dynamic array to a static array,
> Is this OK for you?
> void foo(int[5] arr) {}
> void main() {
> int[] sa = new int[5];
> int[5] da = sa[0 .. 5];
> foo(da);
> }
That's a copy from heap to stack, isn't it? That's what I'm trying to
avoid.
Jason
More information about the Digitalmars-d-learn
mailing list