|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-06-11 06:04:23
From: "Richard Peters" <R.A.Peters_at_[hidden]>
> Then you can replace the postfix increment operator with
>
> number operator++(int)
> { return postfix_increment(*this); }
Why not just:
number operator++(int)
{
return postfix_incrementer<number>(*this);
}
?
> The only thing is that I do not clearly see if there's still the copying
> advantage...
I'm pretty sure there's not: the object will be copied again when it is
sliced for the return value. This one will work:
postfix_incrementer<number> operator++(int)
{
return postfix_incrementer<number>(*this);
}
But of course, the type identity of the result of the function has
changed... :(
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk