It's an optimisation issue. Two functions taking references, one copying and one moving, is the minimal number of operations in each case.
A single function that forces the construction of a temporary at the call site adds to the optimisation load at every call site. Thus: compiles notably slower
View all comments
Show parent comment
11
u/TheThiefMaster C++latest fanatic (and game dev) Sep 20 '26
It's an optimisation issue. Two functions taking references, one copying and one moving, is the minimal number of operations in each case.
A single function that forces the construction of a temporary at the call site adds to the optimisation load at every call site. Thus: compiles notably slower