-1
E && e0 = E () ; 
E e1 ;

is there any differences between these two cases of object declaration.? ;

Volodymyr Boiko
  • 1,533
  • 15
  • 29

1 Answers1

2

In your example :

  • The result of E() is an rvalue (a prvalue to be exact);
  • e0 is an lvalue, of type E&& (rvalue reference to E);
  • e1 is also an lvalue, of type E;
  • e0, by binding to the result of E(), extends its lifetime from temporary to automatic.

Thus, if following code does not make the difference between E and E&& (for example, decltype would but auto wouldn't), they will behave the same.

Quentin
  • 62,093
  • 7
  • 131
  • 191