+ 1
Why const l value ref is called r value ref
Hi If we remove second function from code, it binds all calls to first function. Why const l value reference binds to r value reference? https://sololearn.com/compiler-playground/cwZcXk9kd9SI/?ref=app
1 Answer
+ 2
interesting links I found while trying to find an answer to your question:
https://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/
https://stackoverflow.com/questions/14185985/passing-by-value-vs-const-and-overloads
maybe someone can give you a more concrete answer. I'm still trying to digest the info myself...
my initial understanding is there is some casting going on with const ref arguments so it can accept both l-values and r-values...