Commit 3b46c095 authored by Marco Bubke's avatar Marco Bubke

Utils: Add isEmpty to string view

Change-Id: Ib7e77602dcdcdf481f6ab690bacef53c5dd92580
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 01e1f13b
......@@ -85,6 +85,12 @@ public:
return m_size;
}
constexpr
size_type isEmpty() const
{
return m_size == 0;
}
const_iterator begin() const noexcept
{
return data();
......
......@@ -731,6 +731,12 @@ TEST(SmallString, IsEmpty)
ASSERT_TRUE(SmallString().isEmpty());
}
TEST(SmallString, StringViewIsEmpty)
{
ASSERT_FALSE(SmallStringView("text").isEmpty());
ASSERT_TRUE(SmallStringView("").isEmpty());
}
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