简体   繁体   中英

QSharedPointer without the thread-safety overhead?

I need to use a QSharedPointer for the reference counting, but I'll use it in a single-thread application so I don't want the thread-safety overhead (which I assume is fairly expensive).

Is there a way to turn off the thread-safety, or is there an equivalent Qt class that offers reference-counting only? If not, are there stand-alone classes that don't require me to include a big library like boost, or turn on c++11?

Qt 5 has very clever realization of class QMutex . And it must not to use Synchronization Primitives of OS in a single-thread applications. So, I think that using of Qt's smart pointers is a good solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM