traits: how to split parametrized type into basic type and parameters

Philippe Sigaud philippe.sigaud at gmail.com
Mon Feb 14 13:19:49 PST 2011


On Mon, Feb 14, 2011 at 22:09, Martin Kinkelin <noone at spam.com> wrote:

> So from the outside, components are accessed either via indexing or
> via x,y,z and w (analog to HLSL/GLSL). I also added some downcasting
> shortcuts via properties, e.g.:
>
> auto f4 = float4(1,2,3,4);
> auto r = f4.xyz + 2.0; // downcast f4 to float3 w/o copying, add double
> assert(r == double3(3,4,5)); // element type of r is double :)

We had some discussions on swizzling here, in the past. It makes for a
nice use of opDispatch(string s).


More information about the Digitalmars-d-learn mailing list