quill
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
detail::buffer< T > Class Template Reference

A contiguous memory buffer with an optional growing ability. More...

#include <base.h>

Inheritance diagram for detail::buffer< T >:
Inheritance graph
[legend]
Collaboration diagram for detail::buffer< T >:
Collaboration graph
[legend]

Public Types

using value_type = T
 
using const_reference = const T &
 

Public Member Functions

 buffer (const buffer &)=delete
 
void operator= (const buffer &)=delete
 
auto begin () noexcept -> T *
 
auto end () noexcept -> T *
 
auto begin () const noexcept -> const T *
 
auto end () const noexcept -> const T *
 
constexpr auto size () const noexcept -> size_t
 Returns the size of this buffer.
 
constexpr auto capacity () const noexcept -> size_t
 Returns the capacity of this buffer.
 
FMTQUILL_CONSTEXPR auto data () noexcept -> T *
 Returns a pointer to the buffer data (not null-terminated).
 
FMTQUILL_CONSTEXPR auto data () const noexcept -> const T *
 
FMTQUILL_CONSTEXPR void clear ()
 Clears this buffer.
 
FMTQUILL_CONSTEXPR void try_resize (size_t count)
 
FMTQUILL_CONSTEXPR void try_reserve (size_t new_capacity)
 
FMTQUILL_CONSTEXPR void push_back (const T &value)
 
template<typename U >
FMTQUILL_CONSTEXPR20 void append (const U *begin, const U *end)
 Appends data to the end of the buffer.
 
template<typename Idx >
FMTQUILL_CONSTEXPR auto operator[] (Idx index) -> T &
 
template<typename Idx >
FMTQUILL_CONSTEXPR auto operator[] (Idx index) const -> const T &
 

Protected Types

using grow_fun = void(*)(buffer &buf, size_t capacity)
 

Protected Member Functions

FMTQUILL_CONSTEXPR buffer (grow_fun grow, size_t sz) noexcept
 
constexpr buffer (grow_fun grow, T *p=nullptr, size_t sz=0, size_t cap=0) noexcept
 
 buffer (buffer &&)=default
 
FMTQUILL_CONSTEXPR void set (T *buf_data, size_t buf_capacity) noexcept
 Sets the buffer data and capacity.
 

Protected Attributes

T * ptr_
 
size_t size_
 
size_t capacity_
 
grow_fun grow_
 

Detailed Description

template<typename T>
class detail::buffer< T >

A contiguous memory buffer with an optional growing ability.

It is an internal class and shouldn't be used directly, only via memory_buffer.


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