Cool thing about D, number #72

Stephen Waits steve at waits.net
Tue Apr 24 14:08:42 PDT 2007


Daniel Keep wrote:
> 
> Now, I have .tuple members for my colour structs, vectors, quaternions,
> matrices, and just about every other aggregate type I've written.

Nice.

Now, I haven't checked in to the world of D in awhile...  I'm wondering 
if you've managed to get to the point of automagic unrolling, factoring, 
and vectorization with these sorts of things (quats, matrices, vectors, 
points)?

In other words.. can we do something along the lines of ..

   Vec3 A,B,C,D,E;
   Vec3 F = A + (Dot(B-A, C+D) * E);

.. and expect it to generate intelligent code, sans temporaries, time 
sucking construction, and so on???

This, minus any sort of vectorization, is doable in C++ through some 
*nasty* template-fu.

What's the state of the art in D?

--Steve



More information about the Digitalmars-d mailing list