forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user