ActionNodes capture lamdas by value
In our actions and conditions, we use lambdas to forward conversion functions to the implementation. These lambdas catch by value [=]
, as we had issues capturing shared_ptrs in the past (seemed to be a reference counting issue). While it works for now, this default behavior is questionable, following the reasoning from the clang-tidy rule cppcoreguidelines-misleading-capture-default-by-value:
By-value capture defaults in member functions can be misleading about whether data members are captured by value or reference. This occurs because specifying the capture default [=] actually captures the this pointer by value, not the data members themselves. As a result, data members are still indirectly accessed via the captured this pointer, which essentially means they are being accessed by reference. Therefore, even when using [=], data members are effectively captured by reference, which might not align with the user’s expectations.
See also !237 (comment 3458514)