Should you take plain old data types by const reference as a function parameter?
Show answer and explanation
Small scalar and other cheap value types should normally be passed by value; a reference can cost the same size while adding indirection and aliasing. Use const reference when copying is materially expensive or identity matters.
Small scalar and other cheap value types should normally be passed by value; a reference can cost the same size while adding indirection and aliasing. Use const reference when copying is materially expensive or identity matters.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.