QSharedData Class
The QSharedData class is a base class for shared data objects. More…
| Header | #include <QSharedData> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Core) |
| Module | Nt 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.