bruns added a comment.
The first question is - why should we use pointers at all (raw,
std::unique_ptr, QScopedPointer, ...) for objects **with local only scope**.
The typical answer is Inheritance, see e.g.
A `Base` pointer can be used to hold an instance of `Base`, `DerivedA` or
If the exact **type is known and the object has local scope**, I don't know
**any** reason to allocate the object on the heap. Allocating on the heap is
just pointless overhead.
Even when the **scope is not local**, but the type is known, it is often
useful to allocate the object on the stack and extend its scope using the
constructor. This applies to any d-pointer classes, where the copy constructur
is hardly more expensive than a move constructor (all of Qts implicitly shared
classes), or where we have a move constructor in the first place.
plugin-simple (branched from master)
To: michaelh, #baloo, #frameworks, mgallien, bruns
Cc: alexeymin, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns