C++17 will add copy capture of this object by value, with a capture specification of [*this]
.
How is this useful? How is it different than capturing this
? Can't this already be achieved in C++14 with [tmp = *this]
?
Bonus for explaining why P0018R3 uses [=, tmp = *this]
instead of [tmp = *this]
in their example. If they had used [tmp = *this]
, all the listed downsides of the C++14 solution would be eliminated.
[=, ..]
part makes sense (if you don't want to capture them explicitly one-by-one, that is).this
is only pointer because there were no references when it was invented).