C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Should postfix increment and decrement operators be automatically obtainable from their prefix versions?

From: Jan Schultke <janschultke_at_[hidden]>
Date: Wed, 24 Jan 2024 20:31:22 +0100
>
This is novel syntax and adds to the difficulty of learning the
language by having yet another odd corner.

Don't get me wrong; I don't feel very strongly about the operator++(int) case.

I'm just making the point that operator++(int) could reasonably be
implemented in terms of operator+, skipping operator++(void) for the
purpose of reducing compile time. The issue is probably minor enough
to just say "let's make it go to operator++(void), who cares" in this
particular case.

However, in the more general case, you sometimes want delegation one
way (often operator@ in terms of operator@=, but sometimes the other
way around). I think this problem space as a whole should be
addressed, instead of focusing on some solution for just
operator++(int) which might not be consistent solutions for other
operators.

Received on 2024-01-24 19:31:34