FE 0.13.1
Header-only C++ frontend library
Loading...
Searching...
No Matches
fe::Vector< T, N, A > Class Template Reference

This is a thin wrapper for absl::InlinedVector<T, N, A> which is a drop-in replacement for std::vector<T, A>. More...

#include <fe/vector.h>

Inheritance diagram for fe::Vector< T, N, A >:
[legend]

Public Types

using Base = detail::VectorBase<T, N, A>

Public Member Functions

Constructors
template<class F>
requires (std::is_invocable_r_v<T, F, size_t>)
constexpr Vector (size_t size, F &&f) noexcept(std::is_nothrow_invocable_r_v< T, F, size_t > &&std::is_nothrow_assignable_v< T &, T >)
template<std::ranges::forward_range R, class F>
requires (std::is_invocable_r_v<T, F, decltype(*std::ranges::begin(range))> && !std::is_same_v<std::decay_t<R>, Vector>)
constexpr Vector (R &&range, F &&f) noexcept(std::is_nothrow_invocable_r_v< T, F, decltype(*std::ranges::begin(range))> &&std::is_nothrow_assignable_v< T &, T >)
insert_range / append_range

Available in C++23 but not absl.

template<std::ranges::forward_range R>
constexpr void insert_range (Base::const_iterator pos, R &&r)
template<std::ranges::forward_range R>
constexpr void append_range (R &&r)
Span
constexpr auto span () noexcept
constexpr auto span () const noexcept
constexpr auto view () const noexcept

Friends

void swap (Vector &v1, Vector &v2) noexcept(noexcept(v1.swap(v2)))

Detailed Description

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
class fe::Vector< T, N, A >

This is a thin wrapper for absl::InlinedVector<T, N, A> which is a drop-in replacement for std::vector<T, A>.

In addition, there are generator-like/lambda-based constructors and conversions to Span available.

Note
Without FE_ABSL this falls back to std::vector<T, A> and N has no effect.

Definition at line 39 of file vector.h.

Member Typedef Documentation

◆ Base

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
using fe::Vector< T, N, A >::Base = detail::VectorBase<T, N, A>

Definition at line 41 of file vector.h.

Constructor & Destructor Documentation

◆ Vector() [1/2]

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
template<class F>
requires (std::is_invocable_r_v<T, F, size_t>)
fe::Vector< T, N, A >::Vector ( size_t size,
F && f )
inlineexplicitconstexprnoexcept

Definition at line 49 of file vector.h.

Referenced by swap, and Vector().

◆ Vector() [2/2]

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
template<std::ranges::forward_range R, class F>
requires (std::is_invocable_r_v<T, F, decltype(*std::ranges::begin(range))> && !std::is_same_v<std::decay_t<R>, Vector>)
fe::Vector< T, N, A >::Vector ( R && range,
F && f )
inlineexplicitconstexprnoexcept

Definition at line 58 of file vector.h.

References Vector().

Member Function Documentation

◆ append_range()

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
template<std::ranges::forward_range R>
void fe::Vector< T, N, A >::append_range ( R && r)
inlineconstexpr

Definition at line 77 of file vector.h.

References insert_range().

◆ insert_range()

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
template<std::ranges::forward_range R>
void fe::Vector< T, N, A >::insert_range ( Base::const_iterator pos,
R && r )
inlineconstexpr

Definition at line 73 of file vector.h.

Referenced by append_range().

◆ span() [1/2]

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
auto fe::Vector< T, N, A >::span ( ) const
inlineconstexprnoexcept

Definition at line 85 of file vector.h.

◆ span() [2/2]

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
auto fe::Vector< T, N, A >::span ( )
inlineconstexprnoexcept

Definition at line 84 of file vector.h.

Referenced by view().

◆ view()

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
auto fe::Vector< T, N, A >::view ( ) const
inlineconstexprnoexcept

Definition at line 86 of file vector.h.

References span().

◆ swap

template<class T, size_t N = Default_Inlined_Size<T>, class A = std::allocator<T>>
void swap ( Vector< T, N, A > & v1,
Vector< T, N, A > & v2 )
friend

Definition at line 89 of file vector.h.

References Vector().


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