sparrow 0.3.0
Loading...
Searching...
No Matches
sparrow::buffer_adaptor< To, FromBufferRef > Class Template Reference

Class which have internally a reference to a contiguous container of a certain type and provides an API to access it as if it was a buffer<T>. More...

#include <buffer_adaptor.hpp>

Inheritance diagram for sparrow::buffer_adaptor< To, FromBufferRef >:
[legend]
Collaboration diagram for sparrow::buffer_adaptor< To, FromBufferRef >:
[legend]

Public Types

using value_type = To
 
using reference = value_type&
 
using const_reference = const value_type&
 
using pointer = value_type*
 
using const_pointer = const value_type*
 
using buffer_reference_value_type = std::remove_cvref_t<FromBufferRef>::value_type
 
using buffer_reference = std::conditional_t<is_const, const FromBufferRef, FromBufferRef>
 
using size_type = std::remove_cvref_t<buffer_reference>::size_type
 
using difference_type = std::remove_cvref_t<buffer_reference>::difference_type
 
using iterator = pointer_iterator<pointer>
 
using const_iterator = pointer_iterator<const_pointer>
 
using reverse_iterator = std::reverse_iterator<iterator>
 
using const_reverse_iterator = std::reverse_iterator<const_iterator>
 

Public Member Functions

 buffer_adaptor (FromBufferRef buf)
 
 buffer_adaptor (const FromBufferRef buf)
 
constexpr pointer data () noexcept
 
constexpr const_pointer data () const noexcept
 
constexpr reference operator[] (size_type idx)
 
constexpr const_reference operator[] (size_type idx) const
 
constexpr reference front ()
 
constexpr const_reference front () const
 
constexpr reference back ()
 
constexpr const_reference back () const
 
constexpr iterator begin () noexcept
 
constexpr iterator end () noexcept
 
constexpr const_iterator begin () const noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
constexpr reverse_iterator rbegin () noexcept
 
constexpr reverse_iterator rend () noexcept
 
constexpr const_reverse_iterator rbegin () const noexcept
 
constexpr const_reverse_iterator rend () const noexcept
 
constexpr const_reverse_iterator crbegin () const noexcept
 
constexpr const_reverse_iterator crend () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr size_type max_size () const noexcept
 
constexpr size_type capacity () const noexcept
 
constexpr bool empty () const noexcept
 
constexpr void reserve (size_type new_cap)
 
constexpr void shrink_to_fit ()
 
constexpr void clear () noexcept
 
constexpr iterator insert (const_iterator pos, const value_type &value)
 
constexpr iterator insert (const_iterator pos, size_type count, const value_type &value)
 
template<class InputIt>
requires std::input_iterator<InputIt> (not is_const)
constexpr iterator insert (const_iterator pos, InputIt first, InputIt last)
 
constexpr iterator insert (const_iterator pos, std::initializer_list< value_type > ilist)
 
template<class... Args>
requires (not is_const)
constexpr iterator emplace (const_iterator pos, Args &&... args)
 
constexpr iterator erase (const_iterator pos)
 
constexpr iterator erase (const_iterator first, const_iterator last)
 
constexpr void push_back (const value_type &value)
 
constexpr void pop_back ()
 
constexpr void resize (size_type new_size)
 
constexpr void resize (size_type new_size, const value_type &value)
 

Static Public Attributes

static constexpr bool is_const = std::is_const_v<To>
 

Detailed Description

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
class sparrow::buffer_adaptor< To, FromBufferRef >

Class which have internally a reference to a contiguous container of a certain type and provides an API to access it as if it was a buffer<T>.

Template Parameters
ToThe type to which the buffer will be adapted. The size of the type To must be equal of bigger than the element type of the container.
FromBufferRefThe type of the container to adapt. If it's a const reference, all non-const methods are disabled.

Definition at line 44 of file buffer_adaptor.hpp.

Member Typedef Documentation

◆ buffer_reference

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::buffer_reference = std::conditional_t<is_const, const FromBufferRef, FromBufferRef>

Definition at line 56 of file buffer_adaptor.hpp.

◆ buffer_reference_value_type

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::buffer_reference_value_type = std::remove_cvref_t<FromBufferRef>::value_type

Definition at line 55 of file buffer_adaptor.hpp.

◆ const_iterator

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::const_iterator = pointer_iterator<const_pointer>

Definition at line 61 of file buffer_adaptor.hpp.

◆ const_pointer

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::const_pointer = const value_type*

Definition at line 52 of file buffer_adaptor.hpp.

◆ const_reference

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::const_reference = const value_type&

Definition at line 50 of file buffer_adaptor.hpp.

◆ const_reverse_iterator

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 63 of file buffer_adaptor.hpp.

◆ difference_type

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::difference_type = std::remove_cvref_t<buffer_reference>::difference_type

Definition at line 59 of file buffer_adaptor.hpp.

◆ iterator

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::iterator = pointer_iterator<pointer>

Definition at line 60 of file buffer_adaptor.hpp.

◆ pointer

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::pointer = value_type*

Definition at line 51 of file buffer_adaptor.hpp.

◆ reference

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::reference = value_type&

Definition at line 49 of file buffer_adaptor.hpp.

◆ reverse_iterator

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 62 of file buffer_adaptor.hpp.

◆ size_type

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::size_type = std::remove_cvref_t<buffer_reference>::size_type

Definition at line 58 of file buffer_adaptor.hpp.

◆ value_type

template<typename To, BufferReference< To > FromBufferRef>
using sparrow::buffer_adaptor< To, FromBufferRef >::value_type = To

Definition at line 48 of file buffer_adaptor.hpp.

Constructor & Destructor Documentation

◆ buffer_adaptor() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
sparrow::buffer_adaptor< To, FromBufferRef >::buffer_adaptor ( FromBufferRef buf)
explicit

Definition at line 202 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ buffer_adaptor() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
sparrow::buffer_adaptor< To, FromBufferRef >::buffer_adaptor ( const FromBufferRef buf)
explicit

Member Function Documentation

◆ back() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::reference sparrow::buffer_adaptor< To, FromBufferRef >::back ( )
nodiscardconstexpr

Definition at line 273 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ back() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_reference sparrow::buffer_adaptor< To, FromBufferRef >::back ( ) const
nodiscardconstexpr

Definition at line 283 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ begin() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_iterator sparrow::buffer_adaptor< To, FromBufferRef >::begin ( ) const
nodiscardconstexprnoexcept

Definition at line 310 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ begin() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::iterator sparrow::buffer_adaptor< To, FromBufferRef >::begin ( )
nodiscardconstexprnoexcept

Definition at line 292 of file buffer_adaptor.hpp.

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

◆ capacity()

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::size_type sparrow::buffer_adaptor< To, FromBufferRef >::capacity ( ) const
nodiscardconstexprnoexcept

Definition at line 415 of file buffer_adaptor.hpp.

◆ cbegin()

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_iterator sparrow::buffer_adaptor< To, FromBufferRef >::cbegin ( ) const
nodiscardconstexprnoexcept

Definition at line 326 of file buffer_adaptor.hpp.

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

◆ cend()

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_iterator sparrow::buffer_adaptor< To, FromBufferRef >::cend ( ) const
nodiscardconstexprnoexcept

Definition at line 334 of file buffer_adaptor.hpp.

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

◆ clear()

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
void sparrow::buffer_adaptor< To, FromBufferRef >::clear ( )
constexprnoexcept

Definition at line 447 of file buffer_adaptor.hpp.

◆ crbegin()

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_reverse_iterator sparrow::buffer_adaptor< To, FromBufferRef >::crbegin ( ) const
nodiscardconstexprnoexcept

Definition at line 376 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ crend()

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_reverse_iterator sparrow::buffer_adaptor< To, FromBufferRef >::crend ( ) const
nodiscardconstexprnoexcept

Definition at line 384 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ data() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_pointer sparrow::buffer_adaptor< To, FromBufferRef >::data ( ) const
nodiscardconstexprnoexcept

Definition at line 229 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ data() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::pointer sparrow::buffer_adaptor< To, FromBufferRef >::data ( )
nodiscardconstexprnoexcept

Definition at line 220 of file buffer_adaptor.hpp.

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

◆ emplace()

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
template<class... Args>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::iterator sparrow::buffer_adaptor< To, FromBufferRef >::emplace ( const_iterator pos,
Args &&... args )
constexpr

Definition at line 517 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ empty()

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
bool sparrow::buffer_adaptor< To, FromBufferRef >::empty ( ) const
nodiscardconstexprnoexcept

Definition at line 422 of file buffer_adaptor.hpp.

Here is the caller graph for this function:

◆ end() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_iterator sparrow::buffer_adaptor< To, FromBufferRef >::end ( ) const
nodiscardconstexprnoexcept

Definition at line 318 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ end() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::iterator sparrow::buffer_adaptor< To, FromBufferRef >::end ( )
nodiscardconstexprnoexcept

Definition at line 301 of file buffer_adaptor.hpp.

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

◆ erase() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::iterator sparrow::buffer_adaptor< To, FromBufferRef >::erase ( const_iterator first,
const_iterator last )
constexpr

Definition at line 555 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ erase() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::iterator sparrow::buffer_adaptor< To, FromBufferRef >::erase ( const_iterator pos)
constexpr

Definition at line 532 of file buffer_adaptor.hpp.

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

◆ front() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::reference sparrow::buffer_adaptor< To, FromBufferRef >::front ( )
nodiscardconstexpr

Definition at line 255 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ front() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_reference sparrow::buffer_adaptor< To, FromBufferRef >::front ( ) const
nodiscardconstexpr

Definition at line 265 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ insert() [1/4]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::iterator sparrow::buffer_adaptor< To, FromBufferRef >::insert ( const_iterator pos,
const value_type & value )
constexpr

Definition at line 456 of file buffer_adaptor.hpp.

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

◆ insert() [2/4]

template<typename To, BufferReference< To > FromBufferRef>
requires std::input_iterator<InputIt> (not is_const)
template<class InputIt>
requires std::input_iterator<InputIt> (not is_const)
buffer_adaptor< To, FromBufferRef >::iterator sparrow::buffer_adaptor< To, FromBufferRef >::insert ( const_iterator pos,
InputIt first,
InputIt last )
constexpr

Definition at line 491 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ insert() [3/4]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::iterator sparrow::buffer_adaptor< To, FromBufferRef >::insert ( const_iterator pos,
size_type count,
const value_type & value )
constexpr

Definition at line 471 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ insert() [4/4]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::iterator sparrow::buffer_adaptor< To, FromBufferRef >::insert ( const_iterator pos,
std::initializer_list< value_type > ilist )
constexpr

Definition at line 507 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ max_size()

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::size_type sparrow::buffer_adaptor< To, FromBufferRef >::max_size ( ) const
nodiscardconstexprnoexcept

Definition at line 407 of file buffer_adaptor.hpp.

Here is the caller graph for this function:

◆ operator[]() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::reference sparrow::buffer_adaptor< To, FromBufferRef >::operator[] ( size_type idx)
nodiscardconstexpr

Definition at line 237 of file buffer_adaptor.hpp.

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

◆ operator[]() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_reference sparrow::buffer_adaptor< To, FromBufferRef >::operator[] ( size_type idx) const
nodiscardconstexpr

Definition at line 247 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ pop_back()

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
void sparrow::buffer_adaptor< To, FromBufferRef >::pop_back ( )
constexpr

Definition at line 587 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ push_back()

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
void sparrow::buffer_adaptor< To, FromBufferRef >::push_back ( const value_type & value)
constexpr

Definition at line 579 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ rbegin() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_reverse_iterator sparrow::buffer_adaptor< To, FromBufferRef >::rbegin ( ) const
nodiscardconstexprnoexcept

Definition at line 360 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ rbegin() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::reverse_iterator sparrow::buffer_adaptor< To, FromBufferRef >::rbegin ( )
nodiscardconstexprnoexcept

Definition at line 342 of file buffer_adaptor.hpp.

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

◆ rend() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::const_reverse_iterator sparrow::buffer_adaptor< To, FromBufferRef >::rend ( ) const
nodiscardconstexprnoexcept

Definition at line 368 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ rend() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
buffer_adaptor< To, FromBufferRef >::reverse_iterator sparrow::buffer_adaptor< To, FromBufferRef >::rend ( )
nodiscardconstexprnoexcept

Definition at line 351 of file buffer_adaptor.hpp.

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

◆ reserve()

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
void sparrow::buffer_adaptor< To, FromBufferRef >::reserve ( size_type new_cap)
constexpr

Definition at line 429 of file buffer_adaptor.hpp.

◆ resize() [1/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
void sparrow::buffer_adaptor< To, FromBufferRef >::resize ( size_type new_size)
constexpr

Definition at line 595 of file buffer_adaptor.hpp.

◆ resize() [2/2]

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
void sparrow::buffer_adaptor< To, FromBufferRef >::resize ( size_type new_size,
const value_type & value )
constexpr

Definition at line 606 of file buffer_adaptor.hpp.

Here is the call graph for this function:

◆ shrink_to_fit()

template<typename To, BufferReference< To > FromBufferRef>
requires (not is_const)
void sparrow::buffer_adaptor< To, FromBufferRef >::shrink_to_fit ( )
constexpr

Definition at line 437 of file buffer_adaptor.hpp.

◆ size()

template<typename To, BufferReference< To > FromBufferRef>
requires T_is_const_if_FromBufferRef_is_const<FromBufferRef, To>
buffer_adaptor< To, FromBufferRef >::size_type sparrow::buffer_adaptor< To, FromBufferRef >::size ( ) const
nodiscardconstexprnoexcept

Definition at line 394 of file buffer_adaptor.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ is_const

template<typename To, BufferReference< To > FromBufferRef>
bool sparrow::buffer_adaptor< To, FromBufferRef >::is_const = std::is_const_v<To>
staticconstexpr

Definition at line 53 of file buffer_adaptor.hpp.


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