Sorry I haven't read about recursive lambdas yet but here is a better example in order to have unique functionality, including move semantics:


struct A
{

    int i;

    A & operator = (A const & a) { i = a.i; return * this; }
    A & operator = (A && a) { i = std::move(a.i); return * this; }
    A volatile & operator = (A const & a) volatile { i = a.i; return * this; }
    A volatile & operator = (A && a) volatile { i = std::move(a.i); return * this; }
};


struct A
{

    int i;

    template <qualifier Q, qualifier P>
        A Q & operator = (A P a) Q { i = std::move_or_copy(a.i); return * this; }
};


Where:

template <typename T>
    typename std::remove_reference<T>::type & move_or_copy( T const & t ) noexcept;

template <typename T>
    typename std::remove_reference<T>::type && move_or_copy( T && t ) noexcept;


It follows the purpose of the "template" notion as well.


--

Phil Bouchard
Founder
C.: (819) 328-4743

Fornux Logo


On 9/29/19 12:50 PM, Gašper Ažman wrote:
This proposal introduces a new kind of entity - a qualifier - which will need to operate correctly with all parts of the language, and it does not solve the problem of recursive lambdas, nor all save the deduction of the qualifier that "deducing this" solves. I think there is a pretty large body of work required here before it's a better solution. All the other parameters can already be handled with existing metaprogramming, too.

Gašper

On Sun, Sep 29, 2019, 14:14 Phil Bouchard via Std-Proposals <std-proposals@lists.isocpp.org> wrote:

The approach I propose is more generic as it can apply to all other parameters as well; not only "this".


--

Phil Bouchard
Founder
C.: (819) 328-4743

Fornux Logo
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals