3 ms·
aside from what others wrote, it’s also non local - whether std::move even does anything is dependent on the signature of foo - if foo takes it by const& you ma
by vlovich123 10mo ago
aside from what others wrote, it’s also non local - whether std::move even does anything is dependent on the signature of foo - if foo takes it by const& you may think you’ve transferred ownership when it hasn’t actually happened.
- masklinn 10mo agoThat is static though, that `foo` takes its parameter by `const&` and will thus not move it is available to the compiler (or other tooling) at compile time. The point of contention is whether that is always the case, or whether there are situations where moving from the parameter is a runtime decision.
- vlovich123 10mo agoOthers have already answered that for you. I specifically said it’s non local which means it’s difficult for a human to reason about at the call site.