sparrow 2.2.1
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Loading...
Searching...
No Matches
sparrow::buffer< T > Class Template Reference

Object that owns a piece of contiguous memory. More...

#include <buffer.hpp>

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

Public Types

using allocator_type = typename base_type::allocator_type
 
using default_allocator = xsimd::aligned_allocator<T>
 
using value_type = T
 
using reference = value_type&
 
using const_reference = const value_type&
 
using pointer = typename alloc_traits::pointer
 
using const_pointer = typename alloc_traits::const_pointer
 
using size_type = typename alloc_traits::size_type
 
using difference_type = typename alloc_traits::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 ()=default
 
template<class A>
requires (not std::same_as<A, buffer<T>> and allocator<A>)
constexpr buffer (const A &a)
 
template<allocator A>
constexpr buffer (size_type n, const A &a)
 
template<allocator A>
constexpr buffer (size_type n, const value_type &v, const A &a)
 
template<allocator A>
constexpr buffer (pointer p, size_type n, const A &a)
 
template<allocator A>
constexpr buffer (std::initializer_list< value_type > init, const A &a)
 
template<class It, allocator A>
constexpr buffer (It first, It last, const A &a)
 
template<std::ranges::input_range Range, allocator A>
requires (std::same_as<std::ranges::range_value_t<Range>, T> && !is_buffer_view<Range>)
constexpr buffer (const Range &range, const A &a)
 
 ~buffer ()
 
constexpr buffer (const buffer &rhs)
 
template<allocator A>
constexpr buffer (const buffer &rhs, const A &a)
 
constexpr buffer (buffer &&rhs) noexcept=default
 
template<allocator A>
constexpr buffer (buffer &&rhs, const A &a)
 
constexpr bufferoperator= (const buffer &rhs)
 
constexpr bufferoperator= (buffer &&rhs)
 
constexpr bufferoperator= (std::initializer_list< value_type > init)
 
constexpr reference operator[] (size_type i)
 
constexpr const_reference operator[] (size_type i) const
 
constexpr reference front ()
 
constexpr const_reference front () const
 
constexpr reference back ()
 
constexpr const_reference back () const
 
template<class U = T>
constexpr U * data () noexcept
 
template<class U = T>
constexpr const U * data () const noexcept
 
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 bool empty () const noexcept
 
constexpr size_type capacity () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr size_type max_size () const noexcept
 
constexpr void reserve (size_type new_cap)
 
constexpr void shrink_to_fit ()
 
constexpr void clear ()
 
constexpr iterator insert (const_iterator pos, const T &value)
 
constexpr iterator insert (const_iterator pos, T &&value)
 
constexpr iterator insert (const_iterator pos, size_type count, const T &value)
 
template<mpl::iterator_of_type< T > InputIt>
constexpr iterator insert (const_iterator pos, InputIt first, InputIt last)
 
template<std::ranges::input_range R>
requires std::same_as<std::ranges::range_value_t<R>, T>
constexpr iterator insert (const_iterator pos, R &&range)
 
constexpr iterator insert (const_iterator pos, std::initializer_list< T > ilist)
 
template<class... Args>
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 T &value)
 
constexpr void push_back (T &&value)
 
constexpr void pop_back ()
 
constexpr void resize (size_type new_size)
 
constexpr void resize (size_type new_size, const value_type &value)
 
constexpr void swap (buffer &rhs) noexcept
 
template<mpl::iterator_of_type< T > InputIt>
constexpr auto insert (const_iterator pos, InputIt first, InputIt last) -> iterator
 
template<std::ranges::input_range R>
requires std::same_as<std::ranges::range_value_t<R>, T>
constexpr auto insert (const_iterator pos, R &&range) -> iterator
 
template<class It>
constexpr auto allocate_and_copy (size_type n, It first, It last) -> pointer
 
template<class It>
constexpr auto copy_initialize (It first, It last, pointer begin, allocator_type &a) -> pointer
 
constexpr allocator_typeget_allocator () noexcept
 
constexpr const allocator_typeget_allocator () const noexcept
 

Detailed Description

template<class T>
class sparrow::buffer< T >

Object that owns a piece of contiguous memory.

This class provides an API similar to std::vector, with two main differences:

  • it is not templated by the allocator type, but makes use of any_allocator which type-erases it.
  • it can acquire ownership of an already allocated raw buffer.

Definition at line 130 of file buffer.hpp.

Member Typedef Documentation

◆ allocator_type

template<class T>
using sparrow::buffer< T >::allocator_type = typename base_type::allocator_type

Definition at line 143 of file buffer.hpp.

◆ const_iterator

template<class T>
using sparrow::buffer< T >::const_iterator = pointer_iterator<const_pointer>

Definition at line 153 of file buffer.hpp.

◆ const_pointer

template<class T>
using sparrow::buffer< T >::const_pointer = typename alloc_traits::const_pointer

Definition at line 149 of file buffer.hpp.

◆ const_reference

template<class T>
using sparrow::buffer< T >::const_reference = const value_type&

Definition at line 147 of file buffer.hpp.

◆ const_reverse_iterator

template<class T>
using sparrow::buffer< T >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 155 of file buffer.hpp.

◆ default_allocator

template<class T>
using sparrow::buffer< T >::default_allocator = xsimd::aligned_allocator<T>

◆ difference_type

template<class T>
using sparrow::buffer< T >::difference_type = typename alloc_traits::difference_type

Definition at line 151 of file buffer.hpp.

◆ iterator

template<class T>
using sparrow::buffer< T >::iterator = pointer_iterator<pointer>

Definition at line 152 of file buffer.hpp.

◆ pointer

template<class T>
using sparrow::buffer< T >::pointer = typename alloc_traits::pointer

Definition at line 148 of file buffer.hpp.

◆ reference

template<class T>
using sparrow::buffer< T >::reference = value_type&

Definition at line 146 of file buffer.hpp.

◆ reverse_iterator

template<class T>
using sparrow::buffer< T >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 154 of file buffer.hpp.

◆ size_type

template<class T>
using sparrow::buffer< T >::size_type = typename alloc_traits::size_type

Definition at line 150 of file buffer.hpp.

◆ value_type

template<class T>
using sparrow::buffer< T >::value_type = T

Definition at line 145 of file buffer.hpp.

Constructor & Destructor Documentation

◆ buffer() [1/12]

template<class T>
sparrow::buffer< T >::buffer ( )
default
Here is the caller graph for this function:

◆ buffer() [2/12]

template<class T>
template<class A>
requires (not std::same_as<A, buffer<T>> and allocator<A>)
sparrow::buffer< T >::buffer ( const A & a)
inlineexplicitconstexpr

Definition at line 161 of file buffer.hpp.

◆ buffer() [3/12]

template<class T>
template<allocator A>
sparrow::buffer< T >::buffer ( size_type n,
const A & a )
explicitconstexpr

Definition at line 445 of file buffer.hpp.

Here is the call graph for this function:

◆ buffer() [4/12]

template<class T>
template<allocator A>
sparrow::buffer< T >::buffer ( size_type n,
const value_type & v,
const A & a )
constexpr

Definition at line 453 of file buffer.hpp.

Here is the call graph for this function:

◆ buffer() [5/12]

template<class T>
template<allocator A>
sparrow::buffer< T >::buffer ( pointer p,
size_type n,
const A & a )
constexpr

Definition at line 461 of file buffer.hpp.

◆ buffer() [6/12]

template<class T>
template<allocator A>
sparrow::buffer< T >::buffer ( std::initializer_list< value_type > init,
const A & a )
constexpr

Definition at line 468 of file buffer.hpp.

Here is the call graph for this function:

◆ buffer() [7/12]

template<class T>
template<class It, allocator A>
sparrow::buffer< T >::buffer ( It first,
It last,
const A & a )
constexpr

Definition at line 476 of file buffer.hpp.

Here is the call graph for this function:

◆ buffer() [8/12]

template<class T>
requires (std::same_as<std::ranges::range_value_t<Range>, T> && !is_buffer_view<Range>)
template<std::ranges::input_range Range, allocator A>
requires (std::same_as<std::ranges::range_value_t<Range>, T> && !is_buffer_view<Range>)
sparrow::buffer< T >::buffer ( const Range & range,
const A & a )
constexpr

Definition at line 485 of file buffer.hpp.

Here is the call graph for this function:

◆ ~buffer()

template<class T>
sparrow::buffer< T >::~buffer ( )

Definition at line 497 of file buffer.hpp.

Here is the call graph for this function:

◆ buffer() [9/12]

template<class T>
sparrow::buffer< T >::buffer ( const buffer< T > & rhs)
constexpr

Definition at line 503 of file buffer.hpp.

Here is the call graph for this function:

◆ buffer() [10/12]

template<class T>
template<allocator A>
sparrow::buffer< T >::buffer ( const buffer< T > & rhs,
const A & a )
constexpr

Definition at line 516 of file buffer.hpp.

Here is the call graph for this function:

◆ buffer() [11/12]

template<class T>
sparrow::buffer< T >::buffer ( buffer< T > && rhs)
constexprdefaultnoexcept

◆ buffer() [12/12]

template<class T>
template<allocator A>
sparrow::buffer< T >::buffer ( buffer< T > && rhs,
const A & a )
constexpr

Definition at line 529 of file buffer.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ allocate_and_copy()

template<class T>
template<class It>
auto sparrow::buffer< T >::allocate_and_copy ( size_type n,
It first,
It last ) -> pointer
constexpr

Definition at line 1089 of file buffer.hpp.

◆ back() [1/2]

template<class T>
auto sparrow::buffer< T >::back ( )
nodiscardconstexpr

Definition at line 638 of file buffer.hpp.

Here is the call graph for this function:

◆ back() [2/2]

template<class T>
auto sparrow::buffer< T >::back ( ) const
nodiscardconstexpr

Definition at line 645 of file buffer.hpp.

Here is the call graph for this function:

◆ begin() [1/2]

template<class T>
auto sparrow::buffer< T >::begin ( ) const
nodiscardconstexprnoexcept

Definition at line 692 of file buffer.hpp.

Here is the call graph for this function:

◆ begin() [2/2]

template<class T>
auto sparrow::buffer< T >::begin ( )
nodiscardconstexprnoexcept

Definition at line 680 of file buffer.hpp.

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

◆ capacity()

template<class T>
auto sparrow::buffer< T >::capacity ( ) const
nodiscardconstexprnoexcept

Definition at line 759 of file buffer.hpp.

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

◆ cbegin()

template<class T>
auto sparrow::buffer< T >::cbegin ( ) const
nodiscardconstexprnoexcept

Definition at line 704 of file buffer.hpp.

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

◆ cend()

template<class T>
auto sparrow::buffer< T >::cend ( ) const
nodiscardconstexprnoexcept

Definition at line 710 of file buffer.hpp.

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

◆ clear()

template<class T>
void sparrow::buffer< T >::clear ( )
constexpr

Definition at line 837 of file buffer.hpp.

Here is the caller graph for this function:

◆ copy_initialize()

template<class T>
template<class It>
auto sparrow::buffer< T >::copy_initialize ( It first,
It last,
pointer begin,
allocator_type & a ) -> pointer
constexpr

Definition at line 1147 of file buffer.hpp.

◆ crbegin()

template<class T>
auto sparrow::buffer< T >::crbegin ( ) const
nodiscardconstexprnoexcept

Definition at line 740 of file buffer.hpp.

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

◆ crend()

template<class T>
auto sparrow::buffer< T >::crend ( ) const
nodiscardconstexprnoexcept

Definition at line 746 of file buffer.hpp.

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

◆ data() [1/2]

template<class T>
template<class U>
const U * sparrow::buffer< T >::data ( ) const
nodiscardconstexprnoexcept

Definition at line 667 of file buffer.hpp.

◆ data() [2/2]

template<class T>
template<class U>
U * sparrow::buffer< T >::data ( )
nodiscardconstexprnoexcept

Definition at line 653 of file buffer.hpp.

Here is the caller graph for this function:

◆ emplace()

template<class T>
template<class... Args>
buffer< T >::iterator sparrow::buffer< T >::emplace ( const_iterator pos,
Args &&... args )
constexpr

Definition at line 937 of file buffer.hpp.

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

◆ empty()

template<class T>
bool sparrow::buffer< T >::empty ( ) const
nodiscardconstexprnoexcept

Definition at line 752 of file buffer.hpp.

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

◆ end() [1/2]

template<class T>
auto sparrow::buffer< T >::end ( ) const
nodiscardconstexprnoexcept

Definition at line 698 of file buffer.hpp.

Here is the call graph for this function:

◆ end() [2/2]

template<class T>
auto sparrow::buffer< T >::end ( )
nodiscardconstexprnoexcept

Definition at line 686 of file buffer.hpp.

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

◆ erase() [1/2]

template<class T>
auto sparrow::buffer< T >::erase ( const_iterator first,
const_iterator last )
constexpr

Definition at line 967 of file buffer.hpp.

Here is the call graph for this function:

◆ erase() [2/2]

template<class T>
auto sparrow::buffer< T >::erase ( const_iterator pos)
constexpr

Definition at line 959 of file buffer.hpp.

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

◆ front() [1/2]

template<class T>
auto sparrow::buffer< T >::front ( )
nodiscardconstexpr

Definition at line 624 of file buffer.hpp.

Here is the call graph for this function:

◆ front() [2/2]

template<class T>
auto sparrow::buffer< T >::front ( ) const
nodiscardconstexpr

Definition at line 631 of file buffer.hpp.

Here is the call graph for this function:

◆ get_allocator() [1/2]

template<class T>
auto sparrow::buffer_base< T >::get_allocator ( ) const
nodiscardconstexprnoexcept

Definition at line 105 of file buffer.hpp.

Here is the call graph for this function:

◆ get_allocator() [2/2]

template<class T>
auto sparrow::buffer_base< T >::get_allocator ( )
nodiscardconstexprnoexcept

Definition at line 104 of file buffer.hpp.

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

◆ insert() [1/8]

template<class T>
auto sparrow::buffer< T >::insert ( const_iterator pos,
const T & value )
constexpr

Definition at line 846 of file buffer.hpp.

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

◆ insert() [2/8]

template<class T>
template<mpl::iterator_of_type< T > InputIt>
iterator sparrow::buffer< T >::insert ( const_iterator pos,
InputIt first,
InputIt last )
constexpr

◆ insert() [3/8]

template<class T>
template<mpl::iterator_of_type< T > InputIt>
auto sparrow::buffer< T >::insert ( const_iterator pos,
InputIt first,
InputIt last ) -> iterator
constexpr

Definition at line 894 of file buffer.hpp.

◆ insert() [4/8]

template<class T>
template<std::ranges::input_range R>
requires std::same_as<std::ranges::range_value_t<R>, T>
iterator sparrow::buffer< T >::insert ( const_iterator pos,
R && range )
constexpr

◆ insert() [5/8]

template<class T>
template<std::ranges::input_range R>
requires std::same_as<std::ranges::range_value_t<R>, T>
auto sparrow::buffer< T >::insert ( const_iterator pos,
R && range ) -> iterator
constexpr

Definition at line 920 of file buffer.hpp.

◆ insert() [6/8]

template<class T>
auto sparrow::buffer< T >::insert ( const_iterator pos,
size_type count,
const T & value )
constexpr

Definition at line 862 of file buffer.hpp.

Here is the call graph for this function:

◆ insert() [7/8]

template<class T>
auto sparrow::buffer< T >::insert ( const_iterator pos,
std::initializer_list< T > ilist )
constexpr

Definition at line 928 of file buffer.hpp.

Here is the call graph for this function:

◆ insert() [8/8]

template<class T>
auto sparrow::buffer< T >::insert ( const_iterator pos,
T && value )
constexpr

Definition at line 854 of file buffer.hpp.

Here is the call graph for this function:

◆ max_size()

template<class T>
auto sparrow::buffer< T >::max_size ( ) const
nodiscardconstexprnoexcept

Definition at line 781 of file buffer.hpp.

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

◆ operator=() [1/3]

template<class T>
buffer< T > & sparrow::buffer< T >::operator= ( buffer< T > && rhs)
constexpr

Definition at line 572 of file buffer.hpp.

Here is the call graph for this function:

◆ operator=() [2/3]

template<class T>
buffer< T > & sparrow::buffer< T >::operator= ( const buffer< T > & rhs)
constexpr

Definition at line 548 of file buffer.hpp.

Here is the call graph for this function:

◆ operator=() [3/3]

template<class T>
buffer< T > & sparrow::buffer< T >::operator= ( std::initializer_list< value_type > init)
constexpr

Definition at line 599 of file buffer.hpp.

Here is the call graph for this function:

◆ operator[]() [1/2]

template<class T>
auto sparrow::buffer< T >::operator[] ( size_type i)
nodiscardconstexpr

Definition at line 610 of file buffer.hpp.

Here is the call graph for this function:

◆ operator[]() [2/2]

template<class T>
auto sparrow::buffer< T >::operator[] ( size_type i) const
nodiscardconstexpr

Definition at line 617 of file buffer.hpp.

Here is the call graph for this function:

◆ pop_back()

template<class T>
void sparrow::buffer< T >::pop_back ( )
constexpr

Definition at line 992 of file buffer.hpp.

Here is the call graph for this function:

◆ push_back() [1/2]

template<class T>
void sparrow::buffer< T >::push_back ( const T & value)
constexpr

Definition at line 980 of file buffer.hpp.

Here is the call graph for this function:

◆ push_back() [2/2]

template<class T>
void sparrow::buffer< T >::push_back ( T && value)
constexpr

Definition at line 986 of file buffer.hpp.

Here is the call graph for this function:

◆ rbegin() [1/2]

template<class T>
auto sparrow::buffer< T >::rbegin ( ) const
nodiscardconstexprnoexcept

Definition at line 728 of file buffer.hpp.

Here is the call graph for this function:

◆ rbegin() [2/2]

template<class T>
auto sparrow::buffer< T >::rbegin ( )
nodiscardconstexprnoexcept

Definition at line 716 of file buffer.hpp.

Here is the call graph for this function:

◆ rend() [1/2]

template<class T>
auto sparrow::buffer< T >::rend ( ) const
nodiscardconstexprnoexcept

Definition at line 734 of file buffer.hpp.

Here is the call graph for this function:

◆ rend() [2/2]

template<class T>
auto sparrow::buffer< T >::rend ( )
nodiscardconstexprnoexcept

Definition at line 722 of file buffer.hpp.

Here is the call graph for this function:

◆ reserve()

template<class T>
void sparrow::buffer< T >::reserve ( size_type new_cap)
constexpr

Definition at line 787 of file buffer.hpp.

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

◆ resize() [1/2]

template<class T>
void sparrow::buffer< T >::resize ( size_type new_size)
constexpr

Definition at line 1000 of file buffer.hpp.

Here is the call graph for this function:

◆ resize() [2/2]

template<class T>
void sparrow::buffer< T >::resize ( size_type new_size,
const value_type & value )
constexpr

Definition at line 1012 of file buffer.hpp.

Here is the call graph for this function:

◆ shrink_to_fit()

template<class T>
void sparrow::buffer< T >::shrink_to_fit ( )
constexpr

Definition at line 828 of file buffer.hpp.

Here is the call graph for this function:

◆ size()

template<class T>
auto sparrow::buffer< T >::size ( ) const
nodiscardconstexprnoexcept

Definition at line 770 of file buffer.hpp.

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

◆ swap()

template<class T>
void sparrow::buffer< T >::swap ( buffer< T > & rhs)
constexprnoexcept

Definition at line 1024 of file buffer.hpp.

Here is the call graph for this function:

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