c++ - Non-const lvalue reference initialized to prvalue -


if class-type, expression a() prvalue, correct? why legal

a &aref = a(); 

also, found this:

a reference t can initialized object of type t, function of type t, or object implicitly convertible t. once initialized, reference cannot changed refer object. references initialized in following situations:

1) when named lvalue reference variable declared initializer [...]

which justifies action.

i new c++, initializer either expression formed call constructor or containing new operator?


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -