Is it possible to write a type such that it can't implicit capture itself this
with a lambda inside itself:
[&]{}
I currently have a situation where a temporary object is used as a factory to create another object. Inside this a lot of lambda's exist - it would be great to avoid capturing data members by mistake.
(note that this is also about future proofing the code a bit as this can result in some very hard to find bugs - another programmer can come along and not realize this quite easily)
(also note, it would actually be great to capture everything with [&]
in this case as I actually do want to capture everything else by reference as this binds correctly to all the new stuff being created by the factory - [=]
would be incorrect.)