std.algorithm move() struct emptying
bearophile
bearophileHUGS at lycos.com
Tue Aug 31 03:16:17 PDT 2010
Stanislav Blinov:
> > Currently you can take its address, so doesn't that mean that it's an lvalue?
>
> No, you can't. Generally, that is.
> For example:
> enum A
> {
> a,
> b
> }
>
> void main()
> {
> void* p = &A.init; // won't compile
> }
>
> You may be able to take address of what .init returns, but what Andrei
> meant by 'it is not guaranteed' means that this is not always the case.
> So basically, you should not rely on the cases when you can do that.
If in generic code T.init is not guaranteed to be an lvalue, as your example shows, isn't it better to disallow (turning it into a syntax error) &T.init in all cases?
Bye,
bearophile
More information about the Digitalmars-d
mailing list