Template Class buffer

Inheritance Relationships

Derived Type

Class Documentation

template<typename T>
class buffer

A contiguous memory buffer with an optional growing ability.

Subclassed by fmt::v6::basic_memory_buffer< T, SIZE, Allocator >

Public Types

using value_type = T
using const_reference = const T&

Public Functions

buffer(const buffer&)
void operator=(const buffer&)
virtual ~buffer()
T *begin()
T *end()
std::size_t size() const

Returns the size of this buffer.

std::size_t capacity() const

Returns the capacity of this buffer.

T *data()

Returns a pointer to the buffer data.

const T *data() const

Returns a pointer to the buffer data.

void resize(std::size_t new_size)

Resizes the buffer. If T is a POD type new elements may not be initialized.

void clear()

Clears this buffer.

void reserve(std::size_t new_capacity)

Reserves space to store at least capacity elements.

void push_back(const T &value)
template<typename U>
void append(const U *begin, const U *end)

Appends data to the end of the buffer.

T &operator[](std::size_t index)
const T &operator[](std::size_t index) const

Protected Functions

buffer(std::size_t sz)
buffer(T *p = nullptr, std::size_t sz = 0, std::size_t cap = 0)
void set(T *buf_data, std::size_t buf_capacity)

Sets the buffer data and capacity.

virtual void grow(std::size_t capacity) = 0

Increases the buffer capacity to hold at least capacity elements.