Does a const reference class member prolong the life of a temporary?

Only local const references prolong the lifespan. The standard specifies such behavior in §8.5.3/5, [dcl.init.ref], the section on initializers of reference declarations. The reference in your example is bound to the constructor’s argument n, and becomes invalid when the object n is bound to goes out of scope. The lifetime extension is not transitive through … Read more

How come a non-const reference cannot bind to a temporary object?

From this Visual C++ blog article about rvalue references: … C++ doesn’t want you to accidentally modify temporaries, but directly calling a non-const member function on a modifiable rvalue is explicit, so it’s allowed … Basically, you shouldn’t try to modify temporaries for the very reason that they are temporary objects and will die any … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)