BAN: String add front() and back() helpers

This commit is contained in:
Bananymous 2023-03-29 14:10:29 +03:00
parent 1fb8c211f0
commit f9c3ae7090
1 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,12 @@ namespace BAN
const_iterator end() const { return const_iterator(m_data + m_size); } const_iterator end() const { return const_iterator(m_data + m_size); }
iterator end() { return iterator(m_data + m_size); } iterator end() { return iterator(m_data + m_size); }
char front() const { ASSERT(!empty()); return m_data[0]; }
char& front() { ASSERT(!empty()); return m_data[0]; }
char back() const { ASSERT(!empty()); return m_data[m_size - 1]; }
char& back() { ASSERT(!empty()); return m_data[m_size - 1]; }
char operator[](size_type) const; char operator[](size_type) const;
char& operator[](size_type); char& operator[](size_type);