Re: C++ PATCH to implement C++20 P0806R2, Deprecate implicit capture of this via [=]

2018-08-13 Thread Marek Polacek
On Mon, Aug 13, 2018 at 06:27:53PM +1200, Jason Merrill wrote: > On Sun, Aug 12, 2018 at 3:53 PM, Marek Polacek wrote: > > - var = add_capture (lambda, > > -id, > > -initializer, > > -/*by_reference_p=*/ > > -

Re: C++ PATCH to implement C++20 P0806R2, Deprecate implicit capture of this via [=]

2018-08-12 Thread Jason Merrill
On Sun, Aug 12, 2018 at 3:53 PM, Marek Polacek wrote: > - var = add_capture (lambda, > -id, > -initializer, > -/*by_reference_p=*/ > - (this_capture_p > -|

C++ PATCH to implement C++20 P0806R2, Deprecate implicit capture of this via [=]

2018-08-11 Thread Marek Polacek
When we capture the current object (*this) implicitly, it is always captured by reference, even if the capture default is =. This is surprising and irregular so this proposal deprecates implicit capture of this via [=] (not via [&]). Users should now use [=, this] (same