forked from qt-creator/qt-creator
Utils: remove a copy from the SmallString default constructor
StringDataLayout() is now constexpr too. Not that is useful because we have to wait for constexpr new. Change-Id: I34982c8b17e1935de5c65ec6fc1b01b572170966 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -50,15 +50,11 @@ public:
|
|||||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||||
using size_type = std::size_t;
|
using size_type = std::size_t;
|
||||||
|
|
||||||
static_assert(Size < 64
|
static_assert(Size < 64 ? sizeof(Internal::StringDataLayout<Size>) == Size + 1
|
||||||
? sizeof(Internal::StringDataLayout<Size>) == Size + 1
|
: sizeof(Internal::StringDataLayout<Size>) == Size + 2,
|
||||||
: sizeof(Internal::StringDataLayout<Size>) == Size + 2,
|
|
||||||
"Size is wrong");
|
"Size is wrong");
|
||||||
constexpr
|
|
||||||
BasicSmallString() noexcept
|
constexpr BasicSmallString() = default;
|
||||||
: m_data(Internal::StringDataLayout<Size>())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr
|
constexpr
|
||||||
BasicSmallString(const BasicSmallStringLiteral<Size> &stringReference)
|
BasicSmallString(const BasicSmallStringLiteral<Size> &stringReference)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ struct alignas(16) StringDataLayout
|
|||||||
"Size + 1 must be dividable by 16 if under 64 and Size + 2 must be dividable by "
|
"Size + 1 must be dividable by 16 if under 64 and Size + 2 must be dividable by "
|
||||||
"16 if over 64!");
|
"16 if over 64!");
|
||||||
|
|
||||||
StringDataLayout() noexcept { reset(); }
|
constexpr StringDataLayout() noexcept { reset(); }
|
||||||
|
|
||||||
constexpr StringDataLayout(const char *string, size_type size) noexcept
|
constexpr StringDataLayout(const char *string, size_type size) noexcept
|
||||||
: control{0, true, true}
|
: control{0, true, true}
|
||||||
@@ -147,7 +147,7 @@ struct alignas(16) StringDataLayout<MaximumShortStringDataAreaSize,
|
|||||||
"Size + 1 must be dividable by 16 if under 64 and Size + 2 must be dividable by "
|
"Size + 1 must be dividable by 16 if under 64 and Size + 2 must be dividable by "
|
||||||
"16 if over 64!");
|
"16 if over 64!");
|
||||||
|
|
||||||
StringDataLayout() noexcept { reset(); }
|
constexpr StringDataLayout() noexcept { reset(); }
|
||||||
|
|
||||||
constexpr StringDataLayout(const char *string, size_type size) noexcept
|
constexpr StringDataLayout(const char *string, size_type size) noexcept
|
||||||
: control{0, true, true}
|
: control{0, true, true}
|
||||||
|
|||||||
Reference in New Issue
Block a user