@@ -77,6 +77,10 @@ struct StaticString {
7777 return _data;
7878 }
7979
80+ size_t available () const {
81+ return capacity - length ();
82+ }
83+
8084#ifdef CPPUTIL_STATIC_STRING_USE_STD_STRING
8185 operator std::string () const {
8286 return _data;
@@ -95,15 +99,20 @@ struct StaticString {
9599
96100 // volatile combinations:
97101 // clang-format off
98- constexpr void copy (const char *s) volatile { const_cast <StaticString<CAPACITY>*>(this )->copy (s); }
102+ constexpr void copy (const char *s) volatile { const_cast <StaticString<CAPACITY>*>(this )->copy (s); }
103+
104+ template <size_t OTHER_CAP>
105+ constexpr void copy (StaticString<OTHER_CAP> const &other) { copy (other.data ()); }
99106
100- template <size_t OTHER_CAP>
101- constexpr void copy (StaticString<OTHER_CAP> const &other) { copy (other.data ()); }
107+ template <size_t OTHER_CAP>
108+ constexpr void copy (StaticString<OTHER_CAP> volatile const &other) volatile { copy (const_cast <StaticString<OTHER_CAP> const &>( other) .data ()); }
102109
103- template <size_t OTHER_CAP>
104- constexpr void copy (StaticString<OTHER_CAP> volatile const &other) volatile { copy (const_cast <StaticString<OTHER_CAP> const &>( other) .data ()); }
110+ template <size_t OTHER_CAP>
111+ constexpr void copy (StaticString<OTHER_CAP> const &other) volatile { copy (other.data ()); }
105112
106- template <size_t OTHER_CAP>
107- constexpr void copy (StaticString<OTHER_CAP> const &other) volatile { copy (other.data ()); }
113+ auto begin () { return _data; }
114+ auto end () { return _data + length (); }
115+ auto begin () const { return _data; }
116+ auto end () const { return _data + length (); }
108117 // clang-format on
109118};
0 commit comments