as the title says why it is allowed to pass R-values (literals) via a permalink, but is not a normal link
void display(const int& a) { cout << a ; }
will work if called display(5), but without constit it will not work ****** I mean, how the link constshould point to the value of R (anonymous variable) *** ***
display(5)
const
For the last question:
as a constant reference refers to the value of R (anonymous variable)
. ++ , , (.. ).
- , , - , , .. variable literal. , .
variable
literal
Reference - .
Reference
int a = 5; int &b = a;
( 5 ).
5
const int &c = 5;
, .
, , const. , , ( ) literal.
. ; , 5 , 5 . , , , , , . , ++ , , - , , .
, !
. 1 2, "abd" "edf".
"abd"
"edf"
++ const, :
(1) , x == 1 , " 2" , (2) , void display(int& a) , ?
x == 1
void display(int& a)
, const.
, char* , , , . char* "abc", "" char* char undefined. ( , ).
char*
"abc"
char
, ?
r , , . , ( ?)
++ . r- (non-const), . , r , .
, r- ( &&). , , , , , , r-value.
&&