C++ Optimization week!

Started by
13 comments, last by Hodgman 10 years, 6 months ago

- pass objects as const reference when their size is 'relatively' big

Can anyone explain this?

Advertisement

- pass objects as const reference when their size is 'relatively' big

Can anyone explain this?


This secret website can help you answer this and many other questions.

It was a 'why', not a 'how'.

It was a 'why', not a 'how'.


Did you seriously not find the answer even when given a relevant Google search?

It was a 'why', not a 'how'.

Pass by const-reference has the same semantics as pass-by-const-value, but the object isn't actually copied/cloned. As a rule of thumb, large objects are likely expensive to copy, so if you don't need to make copies, you should avoid it.

This topic is closed to new replies.

Advertisement