template <typename T, size_t N = std::dynamic_extent>

class PreallocatedVector

Defined at line 31 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

elfldltl::PreallocatedVector

<T

> wraps a previously allocated but

uninitialized span of T with a container interface that looks like a

std::vector but provides the container.h API for the allocating methods.

For an allocation failure, the Diagnostics object's ResourceLimit

<N

> method

will be called with the error string (the std::string_view parameter). The

methods that usually return void (push_back, emplace_back) instead return

bool, with false indicating allocation failure. The methods that usually

return an iterator (emplace, insert) instead return std::optional

<iterator

>,

with std::nullopt indicating allocation failure.

This can be default-constructed (with zero capacity) and then move-assigned

from another object constructed with storage. It's usually constructed via

the deduction guide with any std::span argument.

Public Methods

void PreallocatedVector<T, N> ()

Defined at line 43 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

void PreallocatedVector<T, N> (PreallocatedVector<T, N> && )

Defined at line 45 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <size_t OtherN>
void PreallocatedVector<T, N> (PreallocatedVector<T, OtherN> && other)

Defined at line 48 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

void PreallocatedVector<T, N> (std::span<T, N> storage)

Defined at line 53 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

void PreallocatedVector<T, N> (std::span<T, N> storage)

Defined at line 53 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

PreallocatedVector<T, N> & operator= (PreallocatedVector<T, N> && )

Defined at line 55 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <size_t OtherN>
PreallocatedVector<T, N> & operator= (PreallocatedVector<T, OtherN> && other)

Defined at line 58 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

void ~PreallocatedVector<T, N> ()

Defined at line 64 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

size_t max_size ()

All the basic std::vector methods that don't need to allocate are here.

Defined at line 68 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

size_t capacity ()

Defined at line 70 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

std::span<T> as_span ()

Defined at line 72 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

std::span<const T> as_span ()

Defined at line 73 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

pointer data ()

Defined at line 75 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_pointer data ()

Defined at line 76 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

size_t size ()

Defined at line 78 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

bool empty ()

Defined at line 80 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

iterator begin ()

Defined at line 82 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

iterator end ()

Defined at line 83 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_iterator begin ()

Defined at line 85 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_iterator end ()

Defined at line 86 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_iterator cbegin ()

Defined at line 88 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_iterator cend ()

Defined at line 89 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

reverse_iterator rbegin ()

Defined at line 91 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

reverse_iterator rend ()

Defined at line 92 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_reverse_iterator rbegin ()

Defined at line 94 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_reverse_iterator rend ()

Defined at line 95 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_reverse_iterator crbegin ()

Defined at line 97 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_reverse_iterator crend ()

Defined at line 98 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

reference at (size_t pos)

Defined at line 100 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_reference at (size_t pos)

Defined at line 101 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

reference operator[] (size_t pos)

Defined at line 103 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_reference operator[] (size_t pos)

Defined at line 104 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

reference front ()

Defined at line 106 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_reference front ()

Defined at line 107 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

reference back ()

Defined at line 109 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

const_reference back ()

Defined at line 110 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

void pop_back ()

Defined at line 112 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

void clear ()

Defined at line 118 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

iterator erase (iterator pos)

Defined at line 124 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

iterator erase (const_iterator pos)

Defined at line 126 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

iterator erase (iterator first, iterator last)

Defined at line 128 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

iterator erase (const_iterator first, const_iterator last)

Defined at line 139 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

void resize (size_t new_size)

Defined at line 143 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
bool resize (Diagnostics & diagnostics, std::string_view error, size_t new_size)

The cases that require allocation are only supported via the methods

that use the diagnostics.h API to report failures.

Defined at line 154 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
bool resize (Diagnostics & diagnostics, std::string_view error, size_t new_size)

The cases that require allocation are only supported via the methods

that use the diagnostics.h API to report failures.

Defined at line 154 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
bool push_back (Diagnostics & diagnostics, std::string_view error, const T & elt)

Defined at line 174 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
bool push_back (Diagnostics & diagnostics, std::string_view error, const T & elt)

Defined at line 174 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
bool push_back (Diagnostics & diagnostics, std::string_view error, T && elt)

Defined at line 179 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
bool push_back (Diagnostics & diagnostics, std::string_view error, T && elt)

Defined at line 179 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics, typename... Args>
bool emplace_back (Diagnostics & diagnostics, std::string_view error, Args &&... args)

Defined at line 184 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics, typename... Args>
bool emplace_back (Diagnostics & diagnostics, std::string_view error, Args &&... args)

Defined at line 184 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics, typename... Args>
std::optional<iterator> emplace (Diagnostics & diagnostics, std::string_view error, const_iterator it, Args &&... args)

Defined at line 194 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics, typename... Args>
std::optional<iterator> emplace (Diagnostics & diagnostics, std::string_view error, const_iterator it, Args &&... args)

Defined at line 194 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
std::optional<iterator> insert (Diagnostics & diagnostics, std::string_view error, const_iterator it, const T & value)

Defined at line 212 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
std::optional<iterator> insert (Diagnostics & diagnostics, std::string_view error, const_iterator it, const T & value)

Defined at line 212 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
std::optional<iterator> insert (Diagnostics & diagnostics, std::string_view error, const_iterator it, T && value)

Defined at line 218 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics>
std::optional<iterator> insert (Diagnostics & diagnostics, std::string_view error, const_iterator it, T && value)

Defined at line 218 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics, typename InputIt>
std::optional<iterator> insert (Diagnostics & diagnostics, std::string_view error, const_iterator it, InputIt first, InputIt last)

Defined at line 224 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

template <class Diagnostics, typename InputIt>
std::optional<iterator> insert (Diagnostics & diagnostics, std::string_view error, const_iterator it, InputIt first, InputIt last)

Defined at line 224 of file ../../src/lib/elfldltl/include/lib/elfldltl/preallocated-vector.h

Friends

template <typename OtherTsize_t OtherN>
class PreallocatedVector