std.algorithm move() struct emptying

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Aug 29 10:57:56 PDT 2010


On 08/29/2010 12:00 PM, Torarin wrote:
> Hi,
> in std.algorithm move(), this is the operation used to set the source of
> a struct move to .init:
>
>    static T empty;
>    memcpy(&source, &empty, T.sizeof);
>
> Is there any particular reason why the more compact &T.init is not used?

T.init is not guaranteed to be an lvalue.

Andrei


More information about the Digitalmars-d mailing list