apytypes_scratch_vector.h

template<typename T, typename PTR_T>
class SVIteratorBase

Public Types

using value_type = T
using difference_type = std::ptrdiff_t
using reference = value_type&
using const_reference = const value_type&
using pointer = PTR_T
using iterator_category = std::random_access_iterator_tag

Public Functions

inline SVIteratorBase(pointer ptr) noexcept
inline SVIteratorBase &operator++() noexcept
inline SVIteratorBase &operator--() noexcept
inline SVIteratorBase operator++(int) noexcept
inline SVIteratorBase operator--(int) noexcept
inline SVIteratorBase operator+(difference_type n) const noexcept
inline SVIteratorBase operator-(difference_type n) const noexcept
inline SVIteratorBase &operator+=(difference_type n) noexcept
inline SVIteratorBase &operator-=(difference_type n) noexcept
inline reference operator[](std::size_t n) noexcept
inline const_reference operator[](std::size_t n) const noexcept
inline reference operator*() noexcept
inline const_reference operator*() const noexcept
inline auto operator-(SVIteratorBase other) const noexcept
inline bool operator==(SVIteratorBase other) const noexcept
inline bool operator!=(SVIteratorBase other) const noexcept
inline bool operator<(SVIteratorBase other) const noexcept
inline bool operator>(SVIteratorBase other) const noexcept
inline bool operator<=(SVIteratorBase other) const noexcept
inline bool operator>=(SVIteratorBase other) const noexcept

Private Members

pointer _ptr = {}
template<typename T, std::size_t _N_SCRATCH_ELEMENTS = 2, typename Allocator = std::allocator<T>>
class ScratchVector

Public Types

using value_type = T
using allocator_type = std::allocator<T>
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using reference = value_type&
using const_reference = const value_type&
using pointer = typename std::allocator_traits<allocator_type>::pointer
using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer
using iterator = SVIteratorBase<T, T*>
using const_iterator = SVIteratorBase<const T, const T*>
using reverse_iterator = std::reverse_iterator<iterator>
using const_reverse_iterator = std::reverse_iterator<const_iterator>

Public Functions

inline ScratchVector() noexcept
inline ~ScratchVector()
inline ScratchVector(size_type count, const T &value)
inline explicit ScratchVector(size_type count)
template<class InputIt>
inline ScratchVector(InputIt first, InputIt last)
inline ScratchVector(const ScratchVector &other)
inline ScratchVector(std::initializer_list<T> init)
template<typename RANDOM_ACCESS_VECTOR_TYPE, bool SPECIALIZED = false>
inline ScratchVector &operator=(const RANDOM_ACCESS_VECTOR_TYPE &other)
inline ScratchVector &operator=(const ScratchVector &other)
inline iterator begin() noexcept
inline const_iterator begin() const noexcept
inline const_iterator cbegin() const noexcept
inline iterator end() noexcept
inline const_iterator end() const noexcept
inline const_iterator cend() const noexcept
inline reverse_iterator rbegin() noexcept
inline const_reverse_iterator rbegin() const noexcept
inline const_reverse_iterator crbegin() const noexcept
inline reverse_iterator rend() noexcept
inline const_reverse_iterator rend() const noexcept
inline const_reverse_iterator crend() const noexcept
inline size_type size() const noexcept
inline size_type capacity() const noexcept
inline reference back()
inline const_reference back() const
inline reference operator[](size_type pos)
inline const_reference operator[](size_type pos) const
inline reference at(size_type pos)
inline const_reference at(size_type pos) const
inline void resize(size_type count)
inline void push_back(const T &value)
inline void pop_back()
inline explicit operator std::vector<T>() const

Convert a ScratchVector into a std::vector

Private Members

std::size_t _size
std::size_t _capacity
std::array<T, _N_SCRATCH_ELEMENTS> _scratch_data
T *_ptr