Agora  1.2.0
Agora project
fmt::v8::basic_memory_buffer< T, SIZE, Allocator > Class Template Referencefinal

#include <format.h>

Inheritance diagram for fmt::v8::basic_memory_buffer< T, SIZE, Allocator >:
Collaboration diagram for fmt::v8::basic_memory_buffer< T, SIZE, Allocator >:

Public Types

using value_type = T
 
using const_reference = const T &
 
- Public Types inherited from fmt::v8::detail::buffer< T >
using value_type = T
 
using const_reference = const T &
 

Public Member Functions

 basic_memory_buffer (const Allocator &alloc=Allocator())
 
 ~basic_memory_buffer ()
 
 basic_memory_buffer (basic_memory_buffer &&other) throw ()
 
auto operator= (basic_memory_buffer &&other) -> basic_memory_buffer & throw ()
 
auto get_allocator () const -> Allocator
 
void resize (size_t count)
 
void reserve (size_t new_capacity)
 
template<typename ContiguousRange >
void append (const ContiguousRange &range)
 
- Public Member Functions inherited from fmt::v8::detail::buffer< T >
 buffer (const buffer &)=delete
 
void operator= (const buffer &)=delete
 
auto begin () -> T * throw ()
 
auto end () -> T * throw ()
 
auto begin () const -> const T * throw ()
 
auto end () const -> const T * throw ()
 
constexpr auto size () const -> size_t throw ()
 
constexpr auto capacity () const -> size_t throw ()
 
auto data () -> T * throw ()
 
auto data () const -> const T * throw ()
 
void clear ()
 
void try_resize (size_t count)
 
void try_reserve (size_t new_capacity)
 
void push_back (const T &value)
 
template<typename U >
void append (const U *begin, const U *end)
 
template<typename I >
auto operator[] (I index) -> T &
 
template<typename I >
auto operator[] (I index) const -> const T &
 

Protected Member Functions

void grow (size_t size) override
 
- Protected Member Functions inherited from fmt::v8::detail::buffer< T >
 buffer (size_t sz) throw ()
 
 buffer (T *p=nullptr, size_t sz=0, size_t cap=0) throw ()
 
 ~buffer ()=default
 
 buffer (buffer &&)=default
 
void set (T *buf_data, size_t buf_capacity) throw ()
 

Private Member Functions

void deallocate ()
 
void move (basic_memory_buffer &other)
 

Private Attributes

T store_ [SIZE]
 
Allocator alloc_
 

Detailed Description

template<typename T, size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
class fmt::v8::basic_memory_buffer< T, SIZE, Allocator >

\rst A dynamically growing memory buffer for trivially copyable/constructible types with the first SIZE elements stored in the object itself.

You can use the memory_buffer type alias for char instead.

Example**::

auto out = fmt::memory_buffer(); format_to(std::back_inserter(out), "The answer is {}.", 42);

This will append the following output to the out object:

.. code-block:: none

The answer is 42.

The output can be converted to an std::string with to_string(out). \endrst

Member Typedef Documentation

◆ const_reference

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
using fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::const_reference = const T&

◆ value_type

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
using fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::value_type = T

Constructor & Destructor Documentation

◆ basic_memory_buffer() [1/2]

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::basic_memory_buffer ( const Allocator &  alloc = Allocator())
inlineexplicit

◆ ~basic_memory_buffer()

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::~basic_memory_buffer ( )
inline

◆ basic_memory_buffer() [2/2]

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::basic_memory_buffer ( basic_memory_buffer< T, SIZE, Allocator > &&  other)
throw (
)
inline

\rst Constructs a :class:fmt::basic_memory_buffer object moving the content of the other object to it. \endrst

Member Function Documentation

◆ append()

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
template<typename ContiguousRange >
void fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::append ( const ContiguousRange &  range)
inline
Here is the caller graph for this function:

◆ deallocate()

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
void fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::deallocate ( )
inlineprivate

◆ get_allocator()

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
auto fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::get_allocator ( ) const -> Allocator
inline

◆ grow()

template<typename T , size_t SIZE, typename Allocator >
void fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::grow ( size_t  capacity)
overrideprotectedvirtual

Increases the buffer capacity to hold at least capacity elements.

Implements fmt::v8::detail::buffer< T >.

◆ move()

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
void fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::move ( basic_memory_buffer< T, SIZE, Allocator > &  other)
inlineprivate

◆ operator=()

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
auto fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::operator= ( basic_memory_buffer< T, SIZE, Allocator > &&  other) -> basic_memory_buffer&
throw (
)
inline

\rst Moves the content of the other basic_memory_buffer object to this one. \endrst

◆ reserve()

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
void fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::reserve ( size_t  new_capacity)
inline

Increases the buffer capacity to new_capacity.

◆ resize()

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
void fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::resize ( size_t  count)
inline

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

Here is the caller graph for this function:

Member Data Documentation

◆ alloc_

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
Allocator fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::alloc_
private

◆ store_

template<typename T , size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
T fmt::v8::basic_memory_buffer< T, SIZE, Allocator >::store_[SIZE]
private

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