sashoalm
sashoalm

Reputation: 79447

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?

Upvotes: 3

Views: 906

Answers (1)

Vladimir Bershov
Vladimir Bershov

Reputation: 2832

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.

Upvotes: 0

Related Questions