In some C++ sources I saw that an expression result can be saved as a constant reverence. Like this:
const int &x = y + 1;
What does it mean? Is there any documentation on this? I can't find it..
For me it seems to be equivalent to:
const int x = y + 1;
since result of the program stays the same. Is it truly equivalent?
If yes why does the language allows the first way to write it at all? It looks confusing.
If no what is the difference?