View Full Version : inserting to Qlist of QSharedPointer
jajdoo
10th August 2011, 16:04
say i have a reference to an object of the appropriate class i want to insert to my QList of such QSharedPointers - can i use
the_list << the_ref
or should it be
the_list << QSharedPointer<TheClass>(the_ref)
?
ChrisW67
11th August 2011, 00:20
What does your compiler say? It knows what works (is safe) and what does not.
If the_ref is a pointer to TheClass then your first attempt matches no operator<< variant, and the second does.
If the the_ref is a reference to an actual instance then neither is correct.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.