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:
Marco Bubke
2023-08-20 14:26:58 +02:00
parent 1be5475f62
commit 4c52e5ef95
2 changed files with 6 additions and 10 deletions

View File

@@ -50,15 +50,11 @@ public:
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using size_type = std::size_t;
static_assert(Size < 64
? sizeof(Internal::StringDataLayout<Size>) == Size + 1
: sizeof(Internal::StringDataLayout<Size>) == Size + 2,
static_assert(Size < 64 ? sizeof(Internal::StringDataLayout<Size>) == Size + 1
: sizeof(Internal::StringDataLayout<Size>) == Size + 2,
"Size is wrong");
constexpr
BasicSmallString() noexcept
: m_data(Internal::StringDataLayout<Size>())
{
}
constexpr BasicSmallString() = default;
constexpr
BasicSmallString(const BasicSmallStringLiteral<Size> &stringReference)