I have some trouble about
auto reference.
const int i = 1;
auto & ri1 = i;
auto & ri2 = 1; //error
Why is deduced type of ri1
const int
but not ri2
?
Thanks!
I have some trouble about
auto reference.
const int i = 1;
auto & ri1 = i;
auto & ri2 = 1; //error
Why is deduced type of ri1
const int
but not ri2
?
Thanks!
Since i
has type const int
, but 1
has type int
.