pdfmm 0.9.20
Public Member Functions | List of all members
basic_memory_buffer< T, SIZE, Allocator > Class Template Referencefinal

#include <format.h>

Inherits detail::buffer< T >.

Public Member Functions

 basic_memory_buffer (basic_memory_buffer &&other) FMT_NOEXCEPT
 
auto operator= (basic_memory_buffer &&other) FMT_NOEXCEPT -> basic_memory_buffer &
 
void resize (size_t count)
 
void reserve (size_t new_capacity)
 

Detailed Description

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

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). \endrst

Constructor & Destructor Documentation

◆ basic_memory_buffer()

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

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

Member Function Documentation

◆ operator=()

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

\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 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 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.