[Solved] Why we use const and & in this function declaration? [closed]


Creating a reference (&) allows the value to be modified (bad), but saves the compiler making a copy of the object (good).

Making a reference constant, stops the value from being modified.

So const someType & value as a parameter saves a copy and tries to give non-modification promises to the caller.

solved Why we use const and & in this function declaration? [closed]