Hello
I would like advice in the most elegant way for doing this in D:

I have something like this:

struct A
{
int x;
int y;
}

A[] my_array;

And I would need something like this:

assert( my_array[0..n].x == [ my_array[0].x, my_array[1].x, ... my_array[n-1].x ]); assert( my_array[0..n].y == [ my_array[0].y, my_array[1].y, ... my_array[n-1].y ]); assert( my_array.x == [ my_array[0].x, my_array[1].x, ... my_array[$-1].x ]); assert( my_array.y == [ my_array[0].y, my_array[1].y, ... my_array[$-1].y ]);

Is it possible to implement something like this in D? If not, which would be the best way to get an array of x or y component of my_array?

Thank you

Reply via email to