I know (correct me if I'm wrong) that const string& a
is an lvalue reference and string a
is a simple string variable, but I'd like to know if, in this context, there's a difference between the two, because in some tutorials I saw people using const [type]& var
instead of the simple [type] var
.
What's the purpose of using one of the two declaration?
Thanks