Subject: Re: [SG10] P0018 and P0170: lambda-related changes
From: John Spicer (jhs_at_[hidden])
Date: 2016-03-11 16:22:57
> On Mar 11, 2016, at 5:16 PM, Jens Maurer <Jens.Maurer_at_[hidden]> wrote:
> On 03/11/2016 10:02 PM, John Spicer wrote:
>> Even though it doesnât fully express the feature, I prefer __cpp_capture_this for its brevity.
>> There is also some sentiment for getting rid of the existing âcapture this by valueâ semantics that we decided arenât what people really want (i.e., at some point making capture this by value the same thing as the new capture of *this). At that point, we could bump the value of __cpp_capture_this (and all would be right with the world :-)
> I know this isn't the right forum, but so far, I've only needed to
> capture [this] (the pointer value), not the entire object. This is
> for callback functions from network events. I want to call a
> member function of my "connection" class. Of course, I shouldn't
> copy the entire "connection" class for that.
To be clearer, I think with the suggested change you would capture this by reference in that case. You would capture this by value if you wanted the whole object.
Right now we have the ability to capture the this pointer by value, which doesnât really provide additional functionality. I donât know if or when this might happen. Iâve just heard stirring about it.
> Features mailing list
SG10 list run by firstname.lastname@example.org