Commit a4019cb6 authored by Max Kellermann's avatar Max Kellermann

util/StringBuffer: use std::array::const_iterator

parent d29bdf3e
...@@ -42,15 +42,17 @@ public: ...@@ -42,15 +42,17 @@ public:
typedef T &reference; typedef T &reference;
typedef T *pointer; typedef T *pointer;
typedef const T *const_pointer; typedef const T *const_pointer;
typedef const_pointer const_iterator;
typedef size_t size_type; typedef size_t size_type;
static constexpr value_type SENTINEL = '\0'; static constexpr value_type SENTINEL = '\0';
protected: protected:
std::array<value_type, CAPACITY> the_data; typedef std::array<value_type, CAPACITY> Array;
Array the_data;
public: public:
typedef typename Array::const_iterator const_iterator;
constexpr size_type capacity() const { constexpr size_type capacity() const {
return CAPACITY; return CAPACITY;
} }
...@@ -72,7 +74,7 @@ public: ...@@ -72,7 +74,7 @@ public:
} }
constexpr value_type front() const { constexpr value_type front() const {
return c_str()[0]; return the_data.front();
} }
/** /**
...@@ -90,11 +92,11 @@ public: ...@@ -90,11 +92,11 @@ public:
} }
constexpr const_iterator begin() const { constexpr const_iterator begin() const {
return the_data; return the_data.begin();
} }
constexpr const_iterator end() const { constexpr const_iterator end() const {
return the_data + capacity(); return the_data.end();
} }
constexpr operator const_pointer() const { constexpr operator const_pointer() const {
......
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