Date: Wed, 22 Sep 2021 18:30:40 +0100
Sounds cool, would you also allow return by reference?
It’d also be nice to guarantee NRVO in this case.
Jonathan
> On 22 Sep 2021, at 12:12 pm, Desmond Gold Bongcawel via Std-Proposals <std-proposals_at_[hidden]> 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_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
It’d also be nice to guarantee NRVO in this case.
Jonathan
> On 22 Sep 2021, at 12:12 pm, Desmond Gold Bongcawel via Std-Proposals <std-proposals_at_[hidden]> 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_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2021-09-22 12:30:48