High performance C++ framework for concurrent servers
Classes | Public Types | Public Member Functions | List of all members
seastar::circular_buffer< T, Alloc > Class Template Reference

Detailed Description

template<typename T, typename Alloc = std::allocator<T>>
class seastar::circular_buffer< T, Alloc >

A growable double-ended queue container that can be efficiently extended (and shrunk) from both ends. Implementation is a single storage vector.

Similar to libstdc++'s std::deque, except that it uses a single level store, and so is more efficient for simple stored items. Similar to boost::circular_buffer_space_optimized, except it uses uninitialized storage for unoccupied elements (and thus move/copy constructors instead of move/copy assignments, which are less efficient).

The storage of the circular_buffer is expanded automatically in exponential increments. When adding new elements:

Removing elements never invalidates any references and only invalidates begin() or end() iterators:

reserve() may also invalidate all iterators and references.

#include <seastar/core/circular_buffer.hh>

Public Types

using value_type = T
using size_type = size_t
using reference = T &
using pointer = T *
using const_reference = const T &
using const_pointer = const T *
typedef cbiterator< circular_buffer, T > iterator
typedef cbiterator< const circular_buffer, const T > const_iterator

Public Member Functions

 circular_buffer (Alloc alloc) noexcept
 circular_buffer (circular_buffer &&X) noexcept
 circular_buffer (const circular_buffer &X)=delete
circular_bufferoperator= (const circular_buffer &)=delete
circular_bufferoperator= (circular_buffer &&b) noexcept
void push_front (const T &data)
void push_front (T &&data)
template<typename... A>
void emplace_front (A &&... args)
void push_back (const T &data)
void push_back (T &&data)
template<typename... A>
void emplace_back (A &&... args)
T & front () noexcept
const T & front () const noexcept
T & back () noexcept
const T & back () const noexcept
void pop_front () noexcept
void pop_back () noexcept
bool empty () const noexcept
size_t size () const noexcept
size_t capacity () const noexcept
void reserve (size_t)
void clear () noexcept
T & operator[] (size_t idx) noexcept
const T & operator[] (size_t idx) const noexcept
template<typename Func >
void for_each (Func func)
T & access_element_unsafe (size_t idx) noexcept
iterator begin () noexcept
const_iterator begin () const noexcept
iterator end () noexcept
const_iterator end () const noexcept
const_iterator cbegin () const noexcept
const_iterator cend () const noexcept
iterator erase (iterator first, iterator last) noexcept
template<typename... Args>
void emplace_front (Args &&... args)
template<typename... Args>
void emplace_back (Args &&... args)

The documentation for this class was generated from the following file: