Commit 2fc4e17e authored by Marco Bubke's avatar Marco Bubke

Utils: Add Utils::SmallStringView::empty

It is required by many template function because it is used in the STL.

Change-Id: I5a2b9266d0c9d79bdc37cbbc4e7b62fac7a82b8b
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 816a9175
......@@ -97,6 +97,12 @@ public:
return m_size == 0;
}
constexpr
size_type empty() const noexcept
{
return m_size == 0;
}
constexpr
const_iterator begin() const noexcept
{
......
......@@ -1004,6 +1004,12 @@ TEST(SmallString, StringViewIsEmpty)
ASSERT_TRUE(SmallStringView("").isEmpty());
}
TEST(SmallString, StringViewEmpty)
{
ASSERT_FALSE(SmallStringView("text").empty());
ASSERT_TRUE(SmallStringView("").empty());
}
TEST(SmallString, HasContent)
{
ASSERT_TRUE(SmallString("text").hasContent());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment