sol2
sol2 copied to clipboard
Unwanted function argument copying starting from v3.3.0
In push_reference, where the use_reference_tag is calculated, there is a change made in v3.3.0:
meta::neg<std::is_const<T>> -> meta::neg<std::is_const<std::remove_reference_t<T>>>
Due to this change, const T& args meet the reference condition no more, and now they are copied for the call. The first issue here is that some big and heavy objects are copied although we explicitly pass them as const references and don't either want or expect copying to happen. The second issue is inability to pass refcounted objects without making a new reference, which is desired sometimes and was possible before the change.
Looks like it is by initial design documented here Also related #1365 with declined PR