The question is why compiler make copy of a string?
constref enforces the passing of
Ch as a reference aka a Pointer. To ensure that another potential reference to the string doesn't interfere with that passed in reference the compiler ensures a unique copy of the string. For a primitive argument type
const is better. In general you should prefer to use
const because the compiler will pick the most efficient way to pass the parameter - unless you
really need a reference to the passed in value.