rvalue references

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 8 13:16:12 PDT 2015


On Mon, 08 Jun 2015 11:29:56 -0400, bitwise <bitwise.pvt at gmail.com> wrote:

> On Mon, 08 Jun 2015 02:44:46 -0400, Namespace <rswhite4 at gmail.com> wrote:
>
>> On Sunday, 7 June 2015 at 18:40:42 UTC, bitwise wrote:
>>> On Sat, 06 Jun 2015 14:05:54 -0400, Namespace <rswhite4 at gmail.com>  
>>> wrote:
>>>
>>>> Finally all green! Now we need a review.
>>>
>>> You're my hero.
>>>
>>>   Bit
>>
>> Sounds ironic. o.O
>
>
> Ironic or Sarcastic?
> Neither.
>
>    Bit


One useful case for me:

static Mat4 transform()(const auto ref Vec3 pos, const auto ref Vec3  
scale, const auto ref Quat rot)
{
     Mat4 m = Mat4(rot.matrix, 1);

     m.m00 *= scale.x;
     m.m01 *= scale.x;
     m.m02 *= scale.x;

     m.m10 *= scale.y;
     m.m11 *= scale.y;
     m.m12 *= scale.y;

     m.m20 *= scale.z;
     m.m21 *= scale.z;
     m.m22 *= scale.z;

     m.m30 = pos.x;
     m.m31 = pos.y;
     m.m32 = pos.z;

     return m;
}

Currently, my choices are template bloat, or pointless copying.

   Bit


More information about the Digitalmars-d mailing list