A different vector op
Wilfried Kirschenmann
wilfried.kirschenmann at gmail.com
Sun Jul 17 22:08:50 PDT 2011
On Sat, Jul 2, 2011 at 04:12, bearophile <bearophileHUGS at lycos.com> wrote:
> Currently this is not allowed, but do you desire a feature like this?
>
>
> struct Foo {
> int x, y;
> int[100] array;
> }
> void main() {
> auto foos = new Foo[100];
> foos[].y += 10; // ***
> }
In fact, I would be more interested in the opposite :
void main() {
auto foos = new Foo[100];
auto ints = new int[100]
ints = foos[].y;
}
This would simplify the wrinting of numerous application, especially
in the writing of image/video processing (eg. rgb2yuv conversions)
This would also simplify the writing of template library transforming
"array of struct" to "struct of arrays" in a transparent manner for
the library user.
Wilfried
More information about the Digitalmars-d-learn
mailing list