diff options
author | Max Kellermann <max@duempel.org> | 2015-11-11 15:13:46 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-11-11 15:13:46 +0100 |
commit | a944927b56b49842ee91cc1bff3ecac6aeb214fc (patch) | |
tree | 3f570a48475d1c4aee97757f48830b6c69798e0b /src | |
parent | b9a8b0d146447b198d46767695160f53bef473e4 (diff) |
util/StringPointer: add method empty()
Diffstat (limited to 'src')
-rw-r--r-- | src/util/StringPointer.hxx | 6 |
1 files changed, 6 insertions, 0 deletions
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 |