3 ms·
> Do pass expensive types by const reference. Consider `foo(T t)` where `foo` takes ownership of `T` and allows move semantics, but there is risk of copy if `t
by lkjjfowjflasdf 5y ago
> Do pass expensive types by const reference.
Consider `foo(T t)` where `foo` takes ownership of `T` and allows move semantics, but there is risk of copy if `t` is not an r-value reference.
- Kranar 5y agoIt's very rare where doing that is a good idea. A constructor is about the only time when you get much of a benefit.