From a944927b56b49842ee91cc1bff3ecac6aeb214fc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 11 Nov 2015 15:13:46 +0100 Subject: util/StringPointer: add method empty() --- src/util/StringPointer.hxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/util') diff --git a/src/util/StringPointer.hxx b/src/util/StringPointer.hxx index 4859d8265..c3d776981 100644 --- a/src/util/StringPointer.hxx +++ b/src/util/StringPointer.hxx @@ -40,6 +40,8 @@ public: typedef T *pointer; typedef const T *const_pointer; + static constexpr value_type SENTINEL = '\0'; + private: const_pointer value; @@ -59,6 +61,10 @@ public: constexpr const_pointer c_str() const { return value; } + + bool empty() const { + return *value == SENTINEL; + } }; #endif -- cgit v1.2.3