sparrow 0.9.0
Loading...
Searching...
No Matches
sparrow::u8_buffer< T > Class Template Reference

This buffer class is used as storage buffer for all sparrow arrays. More...

#include <u8_buffer.hpp>

Inheritance diagram for sparrow::u8_buffer< T >:
[legend]
Collaboration diagram for sparrow::u8_buffer< T >:
[legend]

Public Types

using holder_type = detail::holder<buffer<std::uint8_t>>
 
using buffer_adaptor_type = buffer_adaptor<T, buffer<std::uint8_t>&>
 
- Public Types inherited from sparrow::buffer_adaptor< T, buffer< std::uint8_t > & >
using value_type
 
using reference
 
using const_reference
 
using pointer
 
using const_pointer
 
using buffer_reference_value_type
 
using buffer_reference
 
using size_type
 
using difference_type
 
using iterator
 
using const_iterator
 
using reverse_iterator
 
using const_reverse_iterator
 

Public Member Functions

constexpr u8_buffer (u8_buffer &&other) noexcept
 Move constructor.
 
constexpr u8_buffer (const u8_buffer &other)
 Copy constructor.
 
u8_bufferoperator= (u8_buffer &&other)=delete
 Move assignment operator (deleted).
 
u8_bufferoperator= (u8_buffer &other)=delete
 Copy assignment operator (deleted).
 
 ~u8_buffer ()=default
 Destructor.
 
constexpr u8_buffer (std::size_t n, const T &val=T{})
 Constructs a buffer with n elements, each initialized to val.
 
template<std::ranges::input_range R>
requires ( !std::same_as<u8_buffer<T>, std::decay_t<R>> && std::convertible_to<std::ranges::range_value_t<R>, T> )
constexpr u8_buffer (R &&range)
 Constructs a buffer with the elements of the range range.
 
constexpr u8_buffer (std::initializer_list< T > ilist)
 Constructs a buffer with the elements of the initializer list ilist.
 
template<allocator A = std::allocator<std::uint8_t>>
constexpr u8_buffer (T *data_ptr, std::size_t count, const A &a=A())
 Constructs a buffer by taking ownership of the storage pointed to by data_ptr.
 
constexpr buffer< std::uint8_t > extract_storage () &&noexcept
 Extracts the storage by moving the wrapped value.
 
- Public Member Functions inherited from sparrow::buffer_adaptor< T, buffer< std::uint8_t > & >
constexpr buffer_adaptor (FromBufferRef buf)
 Constructs a buffer adaptor with a non-const buffer reference.
 
constexpr buffer_adaptor (const FromBufferRef buf)
 Constructs a buffer adaptor with a const buffer reference.
 
constexpr pointer data () noexcept
 Returns a pointer to the underlying data.
 
constexpr const_pointer data () const noexcept
 Returns a constant pointer to the underlying data.
 
constexpr reference operator[] (size_type idx)
 Returns a reference to the element at the specified index.
 
constexpr const_reference operator[] (size_type idx) const
 Returns a constant reference to the element at the specified index.
 
constexpr reference front ()
 Returns a reference to the first element.
 
constexpr const_reference front () const
 Returns a constant reference to the first element.
 
constexpr reference back ()
 Returns a reference to the last element.
 
constexpr const_reference back () const
 Returns a constant reference to the last element.
 
constexpr iterator begin () noexcept
 Returns an iterator to the beginning.
 
constexpr iterator end () noexcept
 Returns an iterator to the end.
 
constexpr const_iterator begin () const noexcept
 Returns a constant iterator to the beginning.
 
constexpr const_iterator end () const noexcept
 Returns a constant iterator to the end.
 
constexpr const_iterator cbegin () const noexcept
 Returns a constant iterator to the beginning.
 
constexpr const_iterator cend () const noexcept
 Returns a constant iterator to the end.
 
constexpr reverse_iterator rbegin () noexcept
 Returns a reverse iterator to the beginning.
 
constexpr reverse_iterator rend () noexcept
 Returns a reverse iterator to the end.
 
constexpr const_reverse_iterator rbegin () const noexcept
 Returns a constant reverse iterator to the beginning.
 
constexpr const_reverse_iterator rend () const noexcept
 Returns a constant reverse iterator to the end.
 
constexpr const_reverse_iterator crbegin () const noexcept
 Returns a constant reverse iterator to the beginning.
 
constexpr const_reverse_iterator crend () const noexcept
 Returns a constant reverse iterator to the end.
 
constexpr size_type size () const noexcept(!SPARROW_CONTRACTS_THROW_ON_FAILURE)
 Returns the number of elements that can be held in currently allocated storage.
 
constexpr size_type max_size () const noexcept
 Returns the maximum possible number of elements.
 
constexpr size_type capacity () const noexcept
 Returns the number of elements that can be held in currently allocated storage.
 
constexpr bool empty () const noexcept
 Checks whether the container is empty.
 
constexpr void reserve (size_type new_cap)
 Reserves storage for at least the specified number of elements.
 
constexpr void shrink_to_fit ()
 Requests the removal of unused capacity.
 
constexpr void clear () noexcept
 Clears the contents.
 
constexpr iterator insert (const_iterator pos, const value_type &value)
 Inserts an element at the specified position.
 
constexpr iterator insert (const_iterator pos, size_type count, const value_type &value)
 Inserts multiple copies of an element at the specified position.
 
constexpr iterator insert (const_iterator pos, InputIt first, InputIt last)
 Inserts elements from a range at the specified position.
 
constexpr iterator insert (const_iterator pos, std::initializer_list< value_type > ilist)
 Inserts elements from an initializer list at the specified position.
 
constexpr iterator emplace (const_iterator pos, Args &&... args)
 Constructs an element in-place at the specified position.
 
constexpr iterator erase (const_iterator pos)
 Erases an element at the specified position.
 
constexpr iterator erase (const_iterator first, const_iterator last)
 Erases elements in the specified range.
 
constexpr void push_back (const value_type &value)
 Adds an element to the end.
 
constexpr void pop_back ()
 Removes the last element.
 
constexpr void resize (size_type new_size)
 Changes the number of elements stored.
 
constexpr void resize (size_type new_size, const value_type &value)
 Changes the number of elements stored, filling new elements with the specified value.
 
constexpr buffer_adaptor (FromBufferRef buf)
 Constructs a buffer adaptor with a non-const buffer reference.
 
constexpr buffer_adaptor (const FromBufferRef buf)
 Constructs a buffer adaptor with a const buffer reference.
 
constexpr pointer data () noexcept
 Returns a pointer to the underlying data.
 
constexpr const_pointer data () const noexcept
 Returns a constant pointer to the underlying data.
 
constexpr reference operator[] (size_type idx)
 Returns a reference to the element at the specified index.
 
constexpr const_reference operator[] (size_type idx) const
 Returns a constant reference to the element at the specified index.
 
constexpr reference front ()
 Returns a reference to the first element.
 
constexpr const_reference front () const
 Returns a constant reference to the first element.
 
constexpr reference back ()
 Returns a reference to the last element.
 
constexpr const_reference back () const
 Returns a constant reference to the last element.
 
constexpr iterator begin () noexcept
 Returns an iterator to the beginning.
 
constexpr const_iterator begin () const noexcept
 Returns a constant iterator to the beginning.
 
constexpr iterator end () noexcept
 Returns an iterator to the end.
 
constexpr const_iterator end () const noexcept
 Returns a constant iterator to the end.
 
constexpr const_iterator cbegin () const noexcept
 Returns a constant iterator to the beginning.
 
constexpr const_iterator cend () const noexcept
 Returns a constant iterator to the end.
 
constexpr reverse_iterator rbegin () noexcept
 Returns a reverse iterator to the beginning.
 
constexpr const_reverse_iterator rbegin () const noexcept
 Returns a constant reverse iterator to the beginning.
 
constexpr reverse_iterator rend () noexcept
 Returns a reverse iterator to the end.
 
constexpr const_reverse_iterator rend () const noexcept
 Returns a constant reverse iterator to the end.
 
constexpr const_reverse_iterator crbegin () const noexcept
 Returns a constant reverse iterator to the beginning.
 
constexpr const_reverse_iterator crend () const noexcept
 Returns a constant reverse iterator to the end.
 
constexpr size_type size () const noexcept(!SPARROW_CONTRACTS_THROW_ON_FAILURE)
 Returns the number of elements that can be held in currently allocated storage.
 
constexpr size_type max_size () const noexcept
 Returns the maximum possible number of elements.
 
constexpr size_type capacity () const noexcept
 Returns the number of elements that can be held in currently allocated storage.
 
constexpr bool empty () const noexcept
 Checks whether the container is empty.
 
constexpr void reserve (size_type new_cap)
 Reserves storage for at least the specified number of elements.
 
constexpr void shrink_to_fit ()
 Requests the removal of unused capacity.
 
constexpr void clear () noexcept
 Clears the contents.
 
constexpr iterator insert (const_iterator pos, const value_type &value)
 Inserts an element at the specified position.
 
constexpr iterator insert (const_iterator pos, size_type count, const value_type &value)
 Inserts multiple copies of an element at the specified position.
 
constexpr iterator insert (const_iterator pos, InputIt first, InputIt last)
 Inserts elements from a range at the specified position.
 
constexpr iterator insert (const_iterator pos, std::initializer_list< value_type > ilist)
 Inserts elements from an initializer list at the specified position.
 
constexpr iterator emplace (const_iterator pos, Args &&... args)
 Constructs an element in-place at the specified position.
 
constexpr iterator erase (const_iterator pos)
 Erases an element at the specified position.
 
constexpr iterator erase (const_iterator first, const_iterator last)
 Erases elements in the specified range.
 
constexpr void push_back (const value_type &value)
 Adds an element to the end.
 
constexpr void pop_back ()
 Removes the last element.
 
constexpr void resize (size_type new_size)
 Changes the number of elements stored.
 
constexpr void resize (size_type new_size, const value_type &value)
 Changes the number of elements stored, filling new elements with the specified value.
 

Additional Inherited Members

- Static Public Attributes inherited from sparrow::buffer_adaptor< T, buffer< std::uint8_t > & >
static constexpr bool is_const
 
static constexpr bool is_const
 

Detailed Description

template<class T>
class sparrow::u8_buffer< T >

This buffer class is used as storage buffer for all sparrow arrays.

Its internal storage can be extracted.

Template Parameters
TThe element type stored in the buffer.

Definition at line 105 of file u8_buffer.hpp.

Member Typedef Documentation

◆ buffer_adaptor_type

template<class T>
using sparrow::u8_buffer< T >::buffer_adaptor_type = buffer_adaptor<T, buffer<std::uint8_t>&>

Definition at line 111 of file u8_buffer.hpp.

◆ holder_type

template<class T>
using sparrow::u8_buffer< T >::holder_type = detail::holder<buffer<std::uint8_t>>

Definition at line 110 of file u8_buffer.hpp.

Constructor & Destructor Documentation

◆ u8_buffer() [1/6]

template<class T>
sparrow::u8_buffer< T >::u8_buffer ( u8_buffer< T > && other)
constexprnoexcept

Move constructor.

Parameters
otherThe buffer to move from.

Definition at line 186 of file u8_buffer.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ u8_buffer() [2/6]

template<class T>
sparrow::u8_buffer< T >::u8_buffer ( const u8_buffer< T > & other)
constexpr

Copy constructor.

Parameters
otherThe buffer to copy from.

Definition at line 193 of file u8_buffer.hpp.

Here is the call graph for this function:

◆ ~u8_buffer()

template<class T>
sparrow::u8_buffer< T >::~u8_buffer ( )
default

Destructor.

◆ u8_buffer() [3/6]

template<class T>
sparrow::u8_buffer< T >::u8_buffer ( std::size_t n,
const T & val = T{} )
constexpr

Constructs a buffer with n elements, each initialized to val.

Parameters
nNumber of elements.
valValue to initialize the elements with.

Definition at line 200 of file u8_buffer.hpp.

Here is the call graph for this function:

◆ u8_buffer() [4/6]

template<class T>
requires ( !std::same_as<u8_buffer<T>, std::decay_t<R>> && std::convertible_to<std::ranges::range_value_t<R>, T> )
template<std::ranges::input_range R>
requires ( !std::same_as<u8_buffer<T>, std::decay_t<R>> && std::convertible_to<std::ranges::range_value_t<R>, T> )
sparrow::u8_buffer< T >::u8_buffer ( R && range)
explicitconstexpr

Constructs a buffer with the elements of the range range.

The range elements must be convertible to T. This constructor performs a copy of the elements in the range into the buffer.

Template Parameters
RThe range type.
Parameters
rangeThe range to copy elements from.

Definition at line 211 of file u8_buffer.hpp.

Here is the call graph for this function:

◆ u8_buffer() [5/6]

template<class T>
sparrow::u8_buffer< T >::u8_buffer ( std::initializer_list< T > ilist)
constexpr

Constructs a buffer with the elements of the initializer list ilist.

Parameters
ilistThe initializer list.

Definition at line 219 of file u8_buffer.hpp.

Here is the call graph for this function:

◆ u8_buffer() [6/6]

template<class T>
template<allocator A>
sparrow::u8_buffer< T >::u8_buffer ( T * data_ptr,
std::size_t count,
const A & a = A() )
constexpr

Constructs a buffer by taking ownership of the storage pointed to by data_ptr.

Template Parameters
AThe allocator type.
Parameters
data_ptrPointer to the storage.
countNumber of elements in the storage.
aThe allocator to use.

Definition at line 228 of file u8_buffer.hpp.

Member Function Documentation

◆ extract_storage()

template<class T>
buffer< std::uint8_t > sparrow::detail::holder< buffer< std::uint8_t > >::extract_storage ( ) &&
inlinenodiscardconstexprnoexcept

Extracts the storage by moving the wrapped value.

Returns
The moved storage value.

Definition at line 61 of file u8_buffer.hpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

template<class T>
u8_buffer & sparrow::u8_buffer< T >::operator= ( u8_buffer< T > && other)
delete

Move assignment operator (deleted).

◆ operator=() [2/2]

template<class T>
u8_buffer & sparrow::u8_buffer< T >::operator= ( u8_buffer< T > & other)
delete

Copy assignment operator (deleted).


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