C++C++11C++14C++17Learn C++

Learn to Use Constant References in C++ Functions

When we call a function with parameters taken by value, it copies the values to be made. This is a relatively inexpensive operation for fundamental types such as int, float, etc. If the parameter is composed of a large compound type, this may result in a certain overhead. For example, let’s consider this following function to combine name, mid name, and surname. string fullname (string…
Read more