summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qtaggedpointer.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-02-28 16:14:21 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-03-19 13:09:25 +0100
commit044f7302143cb4b714712ca52b5ce673bc5fb7d3 (patch)
tree33b75326d5c02cf6d39965292087fe4631044490 /src/corelib/tools/qtaggedpointer.h
parent4a702e580eec2d6efc4f80664725bd90bfcaa4e0 (diff)
Add documentation for QTaggedPointer
The class remains \internal though, as it has a very narrow use-case for low-level code inside Qt. Change-Id: I9d2b6486ce29b290af7f930a0bfc78590a83cc01 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 2d4d688824..11f02d2807 100644
--- a/src/corelib/tools/qtaggedpointer.h
+++ b/src/corelib/tools/qtaggedpointer.h
@@ -80,7 +80,7 @@ public:
static constexpr quintptr tagMask() { return QtPrivate::TagInfo<T>::alignment - 1; }
static constexpr quintptr pointerMask() { return ~tagMask(); }
- explicit QTaggedPointer(Type *pointer = nullptr, TagType tag = TagType()) noexcept
+ explicit QTaggedPointer(T *pointer = nullptr, Tag tag = Tag()) noexcept
: d(quintptr(pointer))
{
Q_STATIC_ASSERT(sizeof(Type*) == sizeof(QTaggedPointer<Type>));
@@ -91,7 +91,7 @@ public:
setTag(tag);
}
- Type &operator*() const
+ Type &operator*() const noexcept
{
Q_ASSERT(pointer());
return *pointer();
@@ -102,7 +102,7 @@ public:
return pointer();
}
- explicit operator bool() const
+ explicit operator bool() const noexcept
{
return !isNull();
}
@@ -119,12 +119,12 @@ public:
return *this;
}
- static constexpr TagType maximumTag() noexcept
+ static constexpr Tag maximumTag() noexcept
{
return TagType(typename QtPrivate::TagInfo<T>::TagType(tagMask()));
}
- void setTag(TagType tag)
+ void setTag(Tag tag)
{
Q_ASSERT_X((static_cast<typename QtPrivate::TagInfo<T>::TagType>(tag) & pointerMask()) == 0,
"QTaggedPointer<T, Tag>::setTag", "Tag is larger than allowed by number of available tag bits");
@@ -132,12 +132,12 @@ public:
d = (d & pointerMask()) | (static_cast<typename QtPrivate::TagInfo<T>::TagType>(tag) & tagMask());
}
- TagType tag() const noexcept
+ Tag tag() const noexcept
{
return TagType(typename QtPrivate::TagInfo<T>::TagType(d & tagMask()));
}
- Type* pointer() const noexcept
+ T* pointer() const noexcept
{
return reinterpret_cast<T*>(d & pointerMask());
}
@@ -147,7 +147,7 @@ public:
return !pointer();
}
- void swap(QTaggedPointer<Type, Tag> &other) noexcept
+ void swap(QTaggedPointer<T, Tag> &other) noexcept
{
qSwap(d, other.d);
}