sol2 icon indicating copy to clipboard operation
sol2 copied to clipboard

Unwanted function argument copying starting from v3.3.0

Open niello opened this issue 2 years ago • 1 comments

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.

niello avatar Jan 04 '23 12:01 niello

Looks like it is by initial design documented here Also related #1365 with declined PR

roman-orekhov avatar Jun 27 '23 20:06 roman-orekhov