HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
basic_memory_buffer< T, SIZE, Allocator > Class Template Referencefinal

#include <format.h>

+ Inheritance diagram for basic_memory_buffer< T, SIZE, Allocator >:

Public Types

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) FMT_NOEXCEPT
 
auto operator= (basic_memory_buffer &&other) FMT_NOEXCEPT-> basic_memory_buffer &
 
auto get_allocator () const -> Allocator
 
void resize (size_t count)
 
void reserve (size_t new_capacity)
 
template<typename ContiguousRange >
void append (const ContiguousRange &range)
 

Protected Member Functions

void grow (size_t size) final FMT_OVERRIDE
 

Detailed Description

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

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**::

fmt::memory_buffer out; format_to(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).

Definition at line 624 of file format.h.

Member Typedef Documentation

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

Definition at line 642 of file format.h.

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

Definition at line 641 of file format.h.

Constructor & Destructor Documentation

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

Definition at line 644 of file format.h.

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

Definition at line 648 of file format.h.

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

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

Definition at line 676 of file format.h.

Member Function Documentation

template<typename T, size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
template<typename ContiguousRange >
void basic_memory_buffer< T, SIZE, Allocator >::append ( const ContiguousRange &  range)
inline

Definition at line 706 of file format.h.

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

Definition at line 692 of file format.h.

template<typename T , size_t SIZE, typename Allocator >
void basic_memory_buffer< T, SIZE, Allocator >::grow ( size_t  size)
finalprotected

Definition at line 712 of file format.h.

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

Moves the content of the other basic_memory_buffer object to this one.

Definition at line 683 of file format.h.

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

Increases the buffer capacity to new_capacity.

Definition at line 701 of file format.h.

template<typename T, size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
void 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.

Definition at line 698 of file format.h.


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