aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/smallstringiterator.h
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2018-03-26 17:10:17 +0200
committerMarco Bubke <marco.bubke@qt.io>2018-04-04 13:34:20 +0000
commitb6cb22899c1e221397649b635a3e07c191971b93 (patch)
tree2e02839c647fbc6cd3a2ccf629f4839b67c20f76 /src/libs/utils/smallstringiterator.h
parent0ecd5436148edc2c8f0ffb12a4acb633c525046c (diff)
Utils: Improve SmallString
The small string control block moved to the beginning, so it is more cache local. The control block is cleanup too, so it should be easier to read. The alignment is removed because it is creating to big holes. Change-Id: I401aeb9d55455cbaa5e722dd8192e54b525ddc40 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/libs/utils/smallstringiterator.h')
-rw-r--r--src/libs/utils/smallstringiterator.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libs/utils/smallstringiterator.h b/src/libs/utils/smallstringiterator.h
index 1217e4bd2b9..82836d78c40 100644
--- a/src/libs/utils/smallstringiterator.h
+++ b/src/libs/utils/smallstringiterator.h
@@ -51,6 +51,7 @@ struct SmallStringIterator : public std::iterator<Category, Type, DistanceType,
{
return ++pointer_;
}
+
SmallStringIterator operator++(int) noexcept
{
return pointer_++;
@@ -121,16 +122,19 @@ struct SmallStringIterator : public std::iterator<Category, Type, DistanceType,
return pointer_;
}
+ constexpr
bool operator==(SmallStringIterator other) const noexcept
{
return pointer_ == other.pointer_;
}
+ constexpr
bool operator!=(SmallStringIterator other) const noexcept
{
return pointer_ != other.pointer_;
}
+ constexpr
bool operator<(SmallStringIterator other) const noexcept
{
return pointer_ < other.pointer_;
@@ -141,6 +145,11 @@ struct SmallStringIterator : public std::iterator<Category, Type, DistanceType,
return pointer_;
}
+ const Pointer data() const noexcept
+ {
+ return pointer_;
+ }
+
private:
Pointer pointer_ = nullptr;
};