问题
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!
回答1:
Since i has type const int, but 1 has type int.
来源:https://stackoverflow.com/questions/14008893/auto-reference-in-c11