use of rvalue reference and auto

前端 未结 4 1592
孤城傲影
孤城傲影 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:31

    auto&& invokes perfect forwarding. As a is an lvalue of type int, d is an lvalue reference to int.

提交回复
热议问题