Don Clugston , dans le message (digitalmars.D:173192), a écrit :
> The question really is, do postfix ++ and -- make sense for reference
> types? Arguably not. From a theoretical sense, the existing behaviour
> does make sense, but in practice, every time it is used, it is probably
> a bug.
>
>
On 20/07/12 17:12, Andrej Mitrovic wrote:
According to TDPL postfix operators are rewritten to call prefix
operators, e.g. on this call for some user-type object named a:
auto b = a++;
// is converted to:
auto b = ((ref x) { auto t = x; ++x; return t; })(a);
But I don't see how this is reasona
On 7/20/12, Andrej Mitrovic wrote:
> According to TDPL
Oh and that's page 369 for those wondering.
According to TDPL postfix operators are rewritten to call prefix
operators, e.g. on this call for some user-type object named a:
auto b = a++;
// is converted to:
auto b = ((ref x) { auto t = x; ++x; return t; })(a);
But I don't see how this is reasonable for classes. Examine:
struct Struct {