C++ Logo


Advanced search

Re: [SG10] P0018 and P0170: lambda-related changes

From: John Spicer <jhs_at_[hidden]>
Date: Fri, 11 Mar 2016 17:22:57 -0500
> 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.
> Agreed.
>> 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.


> Jens
> _______________________________________________
> Features mailing list
> Features_at_[hidden]
> http://www.open-std.org/mailman/listinfo/features

Received on 2016-03-11 23:23:02