c++ - When it comes to applicability, how is "const int &i" different from "const int i" if they're both initialized with a literal/expression? -


i'm still quite new c++, me far, there seems no difference between 2 when comes applicability. difference i'm aware of reference const objects bound temporary object whenever initialized literal or expression.

but since temporary exists long reference that's bound exists, there seems no applicable differences between reference const , const variable if they're both initialized literal/expression.

so there situation can only, or rather, choose 1 on other?

there no difference. imagine reference "another name constant or variable".


Comments