Date: Sun, 29 Sep 2019 14:01:22 -0400
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.
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 <http://www.fornux.com> 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_at_[hidden] > <mailto:std-proposals_at_[hidden]>> 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 <http://www.fornux.com> > -- > Std-Proposals mailing list > Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]> > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals >
Received on 2019-09-29 13:03:34