Template class with dispatched properties
Philippe Sigaud
philippe.sigaud at gmail.com
Thu Nov 7 22:05:44 PST 2013
On Fri, Nov 8, 2013 at 5:55 AM, Ross Hays <throwaway at email.net> wrote:
> And let me say that I really do like that this works in D. I can't imagine
> doing anything like this in C++ (which is what I used primarily in the
> past).
>
> The only reason I joke about it being useless is it really only supports
> vectors of length 2 or 3 (technically 1 as well but that is not really a
> vector) and at that point I am tempted to say it is more efficient to just
> make a Vector2!float class or something of the sorts.
>
Then the next step is to allow swizzling (sp?) :-)
auto myVec = yourVec.yzx; // myVec.x = yourVec.y, myVec.y = yourVec.z,
myVec.z = yourVec.x;
auto myVec2 = yourVec.xxx; // and so on
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20131108/d0c787c9/attachment.html>
More information about the Digitalmars-d-learn
mailing list