As stated in the Barjini Stroustrup's "A Tour of C ++", and a known C ++ 14 practice As such, someone should avoid the naked code in the new and delete . Provides std :: make_shared and std :: make_unique to create smart pointers to store allocated items in the standard library. However, it is not possible to use these routines for non-standard smart pointers, such as QT's own memory management model (with parent), but also smart pointer class like Provides QSharedPointer and QPointer (although later it is not actually a brochure indicator). My question is: Is not it convenient to create Qt analog of std :: make_shared ? To like it, QSharedPtr : Namespace Qt {template & lt; Class T, squares ... Args & gt; QSharedPointer & LT; T & gt; Make_shared (erg & amp; ... args) {return QSharedPointer & lt; T & gt; (New t (std :: forward & lt; ergos & gt; (args) ...)); }} or to create this, QPointer : named place ...
Comments
Post a Comment