E && e0 = E () ;
E e1 ;
is there any differences between these two cases of object declaration.? ;
E && e0 = E () ;
E e1 ;
is there any differences between these two cases of object declaration.? ;
In your example :
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.