forked from qt-creator/qt-creator
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 <tim.jenssen@qt.io>
This commit is contained in:
@@ -97,6 +97,12 @@ public:
|
|||||||
return m_size == 0;
|
return m_size == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr
|
||||||
|
size_type empty() const noexcept
|
||||||
|
{
|
||||||
|
return m_size == 0;
|
||||||
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr
|
||||||
const_iterator begin() const noexcept
|
const_iterator begin() const noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1004,6 +1004,12 @@ TEST(SmallString, StringViewIsEmpty)
|
|||||||
ASSERT_TRUE(SmallStringView("").isEmpty());
|
ASSERT_TRUE(SmallStringView("").isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(SmallString, StringViewEmpty)
|
||||||
|
{
|
||||||
|
ASSERT_FALSE(SmallStringView("text").empty());
|
||||||
|
ASSERT_TRUE(SmallStringView("").empty());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(SmallString, HasContent)
|
TEST(SmallString, HasContent)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(SmallString("text").hasContent());
|
ASSERT_TRUE(SmallString("text").hasContent());
|
||||||
|
|||||||
Reference in New Issue
Block a user