C++ Memory Manament: What is the purpose of a constant reference?
Q: What is the purpose of a constant reference?
A: Passing by a constant reference avoids creating a temporary object (thus copying) and thus can vastly improve performance.
However passing constant references to the standard data types (char, int, long, double, ...) does not result in any performance gain. Usually, these types are passed by value instead.
Bookmarks