summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qtaggedpointer.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-03-19 17:40:56 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-03-19 19:01:31 +0100
commitcef009b1e4d3a3f8108a9f17e8c01e7140a587b4 (patch)
treec51a2317735dc126fb14f334f7b9453c2ccd5c9b /src/corelib/tools/qtaggedpointer.h
parentf5fd9c40cd2db59e2f4eb0f588407658d8a161e6 (diff)
Change QTaggedPointer API to be more similar to other smart pointers in Qt
* Rename pointer() to data() Change-Id: I8ef3e552d45c9990fee4b7efa98e2d878ed2cf98 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/corelib/tools/qtaggedpointer.h')
-rw-r--r--src/corelib/tools/qtaggedpointer.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/tools/qtaggedpointer.h b/src/corelib/tools/qtaggedpointer.h
index 11f02d2807..0c48fa6e4f 100644
--- a/src/corelib/tools/qtaggedpointer.h
+++ b/src/corelib/tools/qtaggedpointer.h
@@ -93,13 +93,13 @@ public:
Type &operator*() const noexcept
{
- Q_ASSERT(pointer());
- return *pointer();
+ Q_ASSERT(data());
+ return *data();
}
Type *operator->() const noexcept
{
- return pointer();
+ return data();
}
explicit operator bool() const noexcept
@@ -137,14 +137,14 @@ public:
return TagType(typename QtPrivate::TagInfo<T>::TagType(d & tagMask()));
}
- T* pointer() const noexcept
+ T* data() const noexcept
{
return reinterpret_cast<T*>(d & pointerMask());
}
bool isNull() const noexcept
{
- return !pointer();
+ return !data();
}
void swap(QTaggedPointer<T, Tag> &other) noexcept
@@ -154,12 +154,12 @@ public:
friend inline bool operator==(const QTaggedPointer<T, Tag> &lhs, const QTaggedPointer<T, Tag> &rhs) noexcept
{
- return lhs.pointer() == rhs.pointer();
+ return lhs.data() == rhs.data();
}
friend inline bool operator!=(const QTaggedPointer<T, Tag> &lhs, const QTaggedPointer<T, Tag> &rhs) noexcept
{
- return lhs.pointer() != rhs.pointer();
+ return lhs.data() != rhs.data();
}
friend inline bool operator==(const QTaggedPointer<T, Tag> &lhs, std::nullptr_t) noexcept
@@ -184,7 +184,7 @@ public:
friend inline bool operator!(const QTaggedPointer<T, Tag> &ptr) noexcept
{
- return !ptr.pointer();
+ return !ptr.data();
}
protected: