use of rvalue reference and auto

前端 未结 4 1579
孤城傲影
孤城傲影 2021-01-19 21:11

Given the code below, everything works. How come that the variable d is reference to int? What is going on?

int main()
{
    int a= 10;
    int &&b =         


        
4条回答
  •  借酒劲吻你
    2021-01-19 21:43

    This has to do with the reference collapsing rules in type deduction.

    A& & becomes A&
    A& && becomes A&
    A&& & becomes A&
    A&& && becomes A&&
    

提交回复
热议问题