Why QScopedPointer<QJsonArray> ?
-
I'm working on a project that I did not create, there are two class members that I'm struggling to understand why they have been created this way?
QScopedPointer<QJsonArray> exampleA; QScopedPointer<QJsonArray> exampleB;
Yet above these there are also:
QJsonArray exampleC; QJsonArray exampleD;
The member names have just been made up by me for the purpose of this post. What is the benefit of using QScopedPointer with a class member?
-
I'm working on a project that I did not create, there are two class members that I'm struggling to understand why they have been created this way?
QScopedPointer<QJsonArray> exampleA; QScopedPointer<QJsonArray> exampleB;
Yet above these there are also:
QJsonArray exampleC; QJsonArray exampleD;
The member names have just been made up by me for the purpose of this post. What is the benefit of using QScopedPointer with a class member?
@SPlatten said in Why QScopedPointer<QJsonArray> ?:
What is the benefit of using QScopedPointer with a class member?
None, it's actually a tiny detriment to performance. The only use case I see is if you are
std::move
ing smart pointers created elsewhere into them but then again, Qt implicit sharing would have taken care of the issue without overheads just by passing-by-value -
@SPlatten said in Why QScopedPointer<QJsonArray> ?:
What is the benefit of using QScopedPointer with a class member?
None, it's actually a tiny detriment to performance. The only use case I see is if you are
std::move
ing smart pointers created elsewhere into them but then again, Qt implicit sharing would have taken care of the issue without overheads just by passing-by-value