Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt smart pointer equivalent to Boost::shared_ptr ?

I have used Boost::shared_ptr in my previous projects and now I want to find a smart-pointer in Qt which does the same/similar thing. Since there are many smart-pointer classes in Qt I was wondering which one to use. Is it QSharedPointer?

like image 536
Ashika Umanga Umagiliya Avatar asked Dec 03 '22 02:12

Ashika Umanga Umagiliya


2 Answers

If you used boost::shared_ptr, continue using it. Prefer boost::shared_ptr to any Qt 'extensions' because boost::shared_ptr is accepted into the C++0x standard (std::shared_ptr).

like image 109
Yakov Galka Avatar answered Dec 21 '22 08:12

Yakov Galka


You want QSharedPointer. You'll find a comparison of all the pointer classes offered by Qt in the detailed description of QSharedPointer.

like image 22
gnud Avatar answered Dec 21 '22 07:12

gnud