[Interest] assigning to QSharedPointer
hamish at risingsoftware.com
Tue May 30 02:50:23 CEST 2017
Which of the following three ways to create a new object and manage it
with QSharedPointer is preferable?
QSharedPointer<Foo> f1, f2, f3; // class members
f2 = QSharedPointer<Foo>::create(); // or even f2 = f2.create()
f3.swap(QSharedPointer<Foo>::create()); // or f3.swap(f3.create()))
I find #2 the easiest to read. Do #2 and #3 perform any differently?
Anything else to consider?
More information about the Interest