|
| | gap_buffer (allocator_type const &allocator=allocator_type{}) noexcept |
| | Construct an empty buffer.
|
| |
| | gap_buffer (std::initializer_list< T > init, allocator_type const &allocator=allocator_type{}) |
| | Construct a buffer with the given initializer list.
|
| |
| | gap_buffer (gap_buffer const &other) noexcept |
| | Copy constructor.
|
| |
| gap_buffer & | operator= (gap_buffer const &other) noexcept |
| | Copy assignment.
|
| |
| | gap_buffer (gap_buffer &&other) noexcept |
| | Move constructor.
|
| |
| gap_buffer & | operator= (gap_buffer &&other) noexcept |
| | Move assignment operator.
|
| |
| | ~gap_buffer () |
| | Destructor.
|
| |
| reference | operator[] (size_type index) noexcept |
| | Index operator.
|
| |
| const_reference | operator[] (size_type index) const noexcept |
| | Index operator.
|
| |
| reference | at (size_type index) |
| | Get item to reference at.
|
| |
| const_reference | at (size_type index) const |
| | Get item to reference at.
|
| |
|
reference | front () noexcept |
| |
|
const_reference | front () const noexcept |
| |
|
reference | back () noexcept |
| |
|
const_reference | back () const noexcept |
| |
|
void | pop_back () noexcept |
| |
|
void | pop_front () noexcept |
| |
| void | clear () noexcept |
| | Clears the buffer.
|
| |
|
size_t | size () const noexcept |
| |
|
bool | empty () const noexcept |
| |
|
size_t | capacity () const noexcept |
| |
|
void | reserve (size_t new_capacity) noexcept |
| |
|
iterator | begin () noexcept |
| |
|
const_iterator | begin () const noexcept |
| |
|
iterator | cbegin () const noexcept |
| |
|
iterator | end () noexcept |
| |
|
const_iterator | end () const noexcept |
| |
|
iterator | cend () const noexcept |
| |
|
template<typename... Args> |
| void | emplace_back (Args &&...args) noexcept |
| |
|
void | push_back (value_type const &value) noexcept |
| |
|
void | push_back (value_type &&value) noexcept |
| |
|
template<typename... Args> |
| void | emplace_front (Args &&...args) noexcept |
| |
|
void | push_front (value_type const &value) noexcept |
| |
|
void | push_front (value_type &&value) noexcept |
| |
| template<typename... Args> |
| iterator | emplace_before (iterator position, Args &&...args) noexcept |
| | Place the gap before the position and emplace at the end of the gap.
|
| |
|
iterator | insert_before (iterator position, value_type const &value) noexcept |
| |
|
iterator | insert_before (iterator position, value_type &&value) noexcept |
| |
| template<typename It > |
| iterator | insert_before (iterator position, It first, It last) noexcept |
| | Insert items.
|
| |
| template<typename... Args> |
| iterator | emplace_after (iterator position, Args &&...args) noexcept |
| | Place the gap after the position and emplace at the beginning of the gap.
|
| |
|
iterator | insert_after (iterator position, value_type const &value) noexcept |
| |
|
iterator | insert_after (iterator position, value_type &&value) noexcept |
| |
| template<typename It > |
| iterator | insert_after (iterator position, It first, It last) noexcept |
| | Insert items.
|
| |
| iterator | erase (iterator first, iterator last) noexcept |
| | Erase items.
|
| |
| iterator | erase (iterator position) noexcept |
| | Erase item.
|
| |
template<typename T, typename Allocator = std::allocator<T>>
class tt::gap_buffer< T, Allocator >
Gap Buffer This container is similar to a std::vector, optimized for repeated insertions and deletion at the same position.
This container is especially useful for text editing where inserts and deletes are happening at a cursor.
Like a std::vector a gap_buffer has extra capacity to do insertion without needing to reallocate, however this capacity can be located anywhere in the allocated memory in a single continues region called the gap.
When inserting/deleting data in the gap_buffer the gap will move to this location.