Hi Desmond,

Your idea sounds like a portion of
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1046r2.html "Automatically Generate More Operators"
of which the status seems... fairly stagnant? but it's hard to tell.
https://github.com/cplusplus/papers/issues/604

–Arthur


On Wed, Sep 22, 2021 at 7:12 AM Desmond Gold Bongcawel via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
I have seen some implementations where the majority of the definition of overloaded post-increment or decrement are common.

I proposed a feature where you can only "explicitly" default the following operators:

class_name operator++(int) = default;
class_name operator--(int) = default;

where they both rely on the pre-increment and decrement operators. The rough equivalent may be:

class_name operator++(int) {
  auto temp = *this;
  ++*this;
  return temp;
}

class_name operator--(int) {
  auto temp = *this;
  --*this;
  return temp;
}

I hope this one could help even if it's a minor addition.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals