Commit a944927b authored by Max Kellermann's avatar Max Kellermann

util/StringPointer: add method empty()

parent b9a8b0d1
...@@ -40,6 +40,8 @@ public: ...@@ -40,6 +40,8 @@ public:
typedef T *pointer; typedef T *pointer;
typedef const T *const_pointer; typedef const T *const_pointer;
static constexpr value_type SENTINEL = '\0';
private: private:
const_pointer value; const_pointer value;
...@@ -59,6 +61,10 @@ public: ...@@ -59,6 +61,10 @@ public:
constexpr const_pointer c_str() const { constexpr const_pointer c_str() const {
return value; return value;
} }
bool empty() const {
return *value == SENTINEL;
}
}; };
#endif #endif
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