by zabzonk · 3y ago · 0 comments
> the lifetime of a named object
in this case "new T" does not create a named object.
the lifetime of an unnamed object is determined explicitly by the programmer (i.e. "delete p" in this case), or implicitly if the object is being pointed to by something like a smart pointer, or is undefined (if you didn't assign the result of calling "new" to anything).
Reference data members are still tricky, though.
if you need a reference-like member, use a pointer.