Post increment and decrement

Kagamin via Digitalmars-d digitalmars-d at
Thu Mar 12 03:17:47 PDT 2015

On Wednesday, 11 March 2015 at 17:23:15 UTC, welkam wrote:
> Because of all this why not make only one increment/decrement 
> operator and have post increment/decrement to be called by 
> template name, because it is a template?
> template post_inc(T) {
> auto tmp = T;
> T++;
> return tmp;
> }

That's how it works
But I see more optimization opportunity here: the result of ++a 
may be not used too, but it still returns the value, which can be 
still suboptimal.

More information about the Digitalmars-d mailing list