auto reference in c++11

后端 未结 1 1881
孤独总比滥情好
孤独总比滥情好 2021-01-21 05:37

I have some trouble about auto reference.

const int i = 1;
auto & ri1 = i; 
auto & ri2 = 1; //error

Why is deduced type of

相关标签:
1条回答
  • 2021-01-21 06:05

    Since i has type const int, but 1 has type int.

    0 讨论(0)
提交回复
热议问题