6.0.0-rc4Source

QSharedData Class

The QSharedData class is a base class for shared data objects. More…

Header#include <QSharedData>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes

List of all members, including inherited members

Public Functions

QSharedData()
QSharedData(const QSharedData &)

Public Variables

std::atomic<int>ref

Detailed Description

Derive a class from QSharedData to hold the data of an implicitly shared class, and refer to it through QSharedDataPointer or QExplicitlySharedDataPointer. The base class provides the atomic reference count those pointers maintain.

See also QSharedDataPointer and QExplicitlySharedDataPointer.

Differences from Qt

The reference count is a public std::atomic<int> member rather than a QAtomicInt.

Member Function Documentation

QSharedData::QSharedData()

Constructs a QSharedData object with a reference count of 0.

QSharedData::QSharedData(const QSharedData &)

Constructs a copy of another QSharedData object. The reference count of the new object is 0, not that of the original.

Member Variable Documentation

std::atomic<int> QSharedData::ref

The reference count of the data object. It is managed by QSharedDataPointer and QExplicitlySharedDataPointer.