Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

#include <flex_vector.hpp>

Public Types

using memory_policy = MemoryPolicy
 
using value_type = T
 
using reference = const T &
 
using size_type = detail::rbts::size_t
 
using difference_type = std::ptrdiff_t
 
using const_reference = const T &
 
using iterator = detail::rbts::rrbtree_iterator< T, MemoryPolicy, B, BL >
 
using const_iterator = iterator
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using transient_type = flex_vector_transient< T, MemoryPolicy, B, BL >
 

Public Member Functions

 flex_vector ()=default
 
 flex_vector (std::initializer_list< T > values)
 
template<typename Iter , typename Sent , std::enable_if_t< detail::compatible_sentinel_v< Iter, Sent >, bool > = true>
 flex_vector (Iter first, Sent last)
 
 flex_vector (size_type n, T v={})
 
 flex_vector (vector< T, MemoryPolicy, B, BL > v)
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
size_type size () const
 
bool empty () const
 
const T & back () const
 
const T & front () const
 
reference operator[] (size_type index) const
 
reference at (size_type index) const
 
bool operator== (const flex_vector &other) const
 
bool operator!= (const flex_vector &other) const
 
flex_vector push_back (value_type value) const &
 
decltype(auto) push_back (value_type value) &&
 
flex_vector push_front (value_type value) const
 
flex_vector set (size_type index, value_type value) const &
 
decltype(auto) set (size_type index, value_type value) &&
 
template<typename FnT >
flex_vector update (size_type index, FnT &&fn) const &
 
template<typename FnT >
decltype(auto) update (size_type index, FnT &&fn) &&
 
flex_vector take (size_type elems) const &
 
decltype(auto) take (size_type elems) &&
 
flex_vector drop (size_type elems) const &
 
decltype(auto) drop (size_type elems) &&
 
decltype(auto) friend operator+ (flex_vector &&l, const flex_vector &r)
 
decltype(auto) friend operator+ (const flex_vector &l, flex_vector &&r)
 
decltype(auto) friend operator+ (flex_vector &&l, flex_vector &&r)
 
flex_vector insert (size_type pos, T value) const &
 
decltype(auto) insert (size_type pos, T value) &&
 
flex_vector insert (size_type pos, flex_vector value) const &
 
decltype(auto) insert (size_type pos, flex_vector value) &&
 
flex_vector erase (size_type pos) const &
 
decltype(auto) erase (size_type pos) &&
 
flex_vector erase (size_type pos, size_type lpos) const &
 
decltype(auto) erase (size_type pos, size_type lpos) &&
 
transient_type transient () const &
 
transient_type transient () &&
 
const impl_timpl () const
 

Static Public Attributes

static constexpr auto bits = B
 
static constexpr auto bits_leaf = BL
 

Private Types

using impl_t = detail::rbts::rrbtree< T, MemoryPolicy, B, BL >
 
using move_t = std::integral_constant< bool, MemoryPolicy::use_transient_rvalues >
 

Private Member Functions

 flex_vector (impl_t impl)
 
flex_vector && push_back_move (std::true_type, value_type value)
 
flex_vector push_back_move (std::false_type, value_type value)
 
flex_vector && set_move (std::true_type, size_type index, value_type value)
 
flex_vector set_move (std::false_type, size_type index, value_type value)
 
template<typename Fn >
flex_vector && update_move (std::true_type, size_type index, Fn &&fn)
 
template<typename Fn >
flex_vector update_move (std::false_type, size_type index, Fn &&fn)
 
flex_vector && take_move (std::true_type, size_type elems)
 
flex_vector take_move (std::false_type, size_type elems)
 
flex_vector && drop_move (std::true_type, size_type elems)
 
flex_vector drop_move (std::false_type, size_type elems)
 

Static Private Member Functions

static flex_vector && concat_move (std::true_type, flex_vector &&l, const flex_vector &r)
 
static flex_vector && concat_move (std::true_type, const flex_vector &l, flex_vector &&r)
 
static flex_vector && concat_move (std::true_type, flex_vector &&l, flex_vector &&r)
 
static flex_vector concat_move (std::false_type, const flex_vector &l, const flex_vector &r)
 

Private Attributes

friend transient_type
 
impl_t impl_ = impl_t::empty()
 

Friends

flex_vector operator+ (const flex_vector &l, const flex_vector &r)
 

Detailed Description

template<typename T, typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
class immer::flex_vector< T, MemoryPolicy, B, BL >

Immutable sequential container supporting both random access, structural sharing and efficient concatenation and slicing.

Template Parameters
TThe type of the values to be stored in the container.
MemoryPolicyMemory management policy. See memory_policy.

This container is very similar to vector_ but also supports :math:O(log(size)) concatenation, slicing and insertion at any point. Its performance characteristics are almost identical until one of these operations is performed. After that, performance is degraded by a constant factor that usually oscilates in the range :math:[1, 2) depending on the operation and the amount of flexible operations that have been performed.

.. tip:: A vector_ can be converted to a flex_vector_ in constant time without any allocation. This is so because the internal structure of a vector is a strict subset of the internal structure of a flexible vector. You can take advantage of this property by creating normal vectors as long as the flexible operations are not needed, and convert later in your processing pipeline once and if these are needed.

Definition at line 61 of file flex_vector.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::const_iterator = iterator

Definition at line 80 of file flex_vector.hpp.

◆ const_reference

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::const_reference = const T&

Definition at line 77 of file flex_vector.hpp.

◆ difference_type

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::difference_type = std::ptrdiff_t

Definition at line 76 of file flex_vector.hpp.

◆ impl_t

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::impl_t = detail::rbts::rrbtree<T, MemoryPolicy, B, BL>
private

Definition at line 63 of file flex_vector.hpp.

◆ iterator

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::iterator = detail::rbts::rrbtree_iterator<T, MemoryPolicy, B, BL>

Definition at line 79 of file flex_vector.hpp.

◆ memory_policy

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::memory_policy = MemoryPolicy

Definition at line 71 of file flex_vector.hpp.

◆ move_t

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::move_t = std::integral_constant<bool, MemoryPolicy::use_transient_rvalues>
private

Definition at line 66 of file flex_vector.hpp.

◆ reference

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::reference = const T&

Definition at line 74 of file flex_vector.hpp.

◆ reverse_iterator

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 81 of file flex_vector.hpp.

◆ size_type

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::size_type = detail::rbts::size_t

Definition at line 75 of file flex_vector.hpp.

◆ transient_type

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::transient_type = flex_vector_transient<T, MemoryPolicy, B, BL>

Definition at line 83 of file flex_vector.hpp.

◆ value_type

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
using immer::flex_vector< T, MemoryPolicy, B, BL >::value_type = T

Definition at line 73 of file flex_vector.hpp.

Constructor & Destructor Documentation

◆ flex_vector() [1/6]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
immer::flex_vector< T, MemoryPolicy, B, BL >::flex_vector ( )
default

Default constructor. It creates a flex_vector of size() == 0. It does not allocate memory and its complexity is $ O(1) $.

◆ flex_vector() [2/6]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
immer::flex_vector< T, MemoryPolicy, B, BL >::flex_vector ( std::initializer_list< T >  values)
inline

Constructs a flex_vector containing the elements in values.

Definition at line 94 of file flex_vector.hpp.

References immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::from_initializer_list().

◆ flex_vector() [3/6]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
template<typename Iter , typename Sent , std::enable_if_t< detail::compatible_sentinel_v< Iter, Sent >, bool > = true>
immer::flex_vector< T, MemoryPolicy, B, BL >::flex_vector ( Iter  first,
Sent  last 
)
inline

Constructs a flex_vector containing the elements in the range defined by the input iterator first and range sentinel last.

Definition at line 105 of file flex_vector.hpp.

References immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::from_range().

◆ flex_vector() [4/6]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
immer::flex_vector< T, MemoryPolicy, B, BL >::flex_vector ( size_type  n,
v = {} 
)
inline

Constructs a vector containing the element val repeated n times.

Definition at line 113 of file flex_vector.hpp.

◆ flex_vector() [5/6]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
immer::flex_vector< T, MemoryPolicy, B, BL >::flex_vector ( vector< T, MemoryPolicy, B, BL >  v)
inline

◆ flex_vector() [6/6]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
immer::flex_vector< T, MemoryPolicy, B, BL >::flex_vector ( impl_t  impl)
inlineprivate

Definition at line 453 of file flex_vector.hpp.

Member Function Documentation

◆ at()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
reference immer::flex_vector< T, MemoryPolicy, B, BL >::at ( size_type  index) const
inline

Returns a const reference to the element at position index. It throws an std::out_of_range exception when $ index \geq size() $. It does not allocate memory and its complexity is effectively $ O(1) $.

Definition at line 191 of file flex_vector.hpp.

References immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::get_check(), and immer::flex_vector< T, MemoryPolicy, B, BL >::impl_.

◆ back()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
const T& immer::flex_vector< T, MemoryPolicy, B, BL >::back ( ) const
inline

◆ begin()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
iterator immer::flex_vector< T, MemoryPolicy, B, BL >::begin ( ) const
inline

Returns an iterator pointing at the first element of the collection. It does not allocate memory and its complexity is $ O(1) $.

Definition at line 132 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::impl_.

Referenced by immer::flex_vector< T, MemoryPolicy, B, BL >::rend().

◆ concat_move() [1/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
static flex_vector&& immer::flex_vector< T, MemoryPolicy, B, BL >::concat_move ( std::true_type  ,
flex_vector< T, MemoryPolicy, B, BL > &&  l,
const flex_vector< T, MemoryPolicy, B, BL > &  r 
)
inlinestaticprivate

◆ concat_move() [2/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
static flex_vector&& immer::flex_vector< T, MemoryPolicy, B, BL >::concat_move ( std::true_type  ,
const flex_vector< T, MemoryPolicy, B, BL > &  l,
flex_vector< T, MemoryPolicy, B, BL > &&  r 
)
inlinestaticprivate

◆ concat_move() [3/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
static flex_vector&& immer::flex_vector< T, MemoryPolicy, B, BL >::concat_move ( std::true_type  ,
flex_vector< T, MemoryPolicy, B, BL > &&  l,
flex_vector< T, MemoryPolicy, B, BL > &&  r 
)
inlinestaticprivate

Definition at line 494 of file flex_vector.hpp.

◆ concat_move() [4/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
static flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::concat_move ( std::false_type  ,
const flex_vector< T, MemoryPolicy, B, BL > &  l,
const flex_vector< T, MemoryPolicy, B, BL > &  r 
)
inlinestaticprivate

◆ drop() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::drop ( size_type  elems) const &
inline

Returns a vector without the first min(elems, size()) elements. It may allocate memory and its complexity is effectively $ O(1) $.

Example .. literalinclude:: ../example/flex-vector/flex-vector.cpp :language: c++ :dedent: 8 :start-after: drop/start :end-before: drop/end

Definition at line 329 of file flex_vector.hpp.

References immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::drop(), and immer::flex_vector< T, MemoryPolicy, B, BL >::impl_.

Referenced by immer::flex_vector< T, MemoryPolicy, B, BL >::erase(), and immer::flex_vector< T, MemoryPolicy, B, BL >::insert().

◆ drop() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) immer::flex_vector< T, MemoryPolicy, B, BL >::drop ( size_type  elems) &&
inline

◆ drop_move() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector&& immer::flex_vector< T, MemoryPolicy, B, BL >::drop_move ( std::true_type  ,
size_type  elems 
)
inlineprivate

◆ drop_move() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::drop_move ( std::false_type  ,
size_type  elems 
)
inlineprivate

◆ empty()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
bool immer::flex_vector< T, MemoryPolicy, B, BL >::empty ( ) const
inline

Returns true if there are no elements in the container. It does not allocate memory and its complexity is $ O(1) $.

Definition at line 164 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::impl_, and immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::size.

◆ end()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
iterator immer::flex_vector< T, MemoryPolicy, B, BL >::end ( ) const
inline

Returns an iterator pointing just after the last element of the collection. It does not allocate and its complexity is $ O(1) $.

Definition at line 138 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::impl_.

Referenced by immer::flex_vector< T, MemoryPolicy, B, BL >::rbegin().

◆ erase() [1/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::erase ( size_type  pos) const &
inline

Returns a flex_vector without the element at index pos. It may allocate memory and its complexity is $ O(log(size)) $

Example .. literalinclude:: ../example/flex-vector/flex-vector.cpp :language: c++ :dedent: 8 :start-after: erase/start :end-before: erase/end

Definition at line 413 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::drop(), and immer::flex_vector< T, MemoryPolicy, B, BL >::take().

◆ erase() [2/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) immer::flex_vector< T, MemoryPolicy, B, BL >::erase ( size_type  pos) &&
inline

◆ erase() [3/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::erase ( size_type  pos,
size_type  lpos 
) const &
inline

◆ erase() [4/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) immer::flex_vector< T, MemoryPolicy, B, BL >::erase ( size_type  pos,
size_type  lpos 
) &&
inline

◆ front()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
const T& immer::flex_vector< T, MemoryPolicy, B, BL >::front ( ) const
inline

◆ impl()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
const impl_t& immer::flex_vector< T, MemoryPolicy, B, BL >::impl ( ) const
inline

◆ insert() [1/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::insert ( size_type  pos,
value 
) const &
inline

Returns a flex_vector with the value inserted at index pos. It may allocate memory and its complexity is $ O(log(size)) $

Example .. literalinclude:: ../example/flex-vector/flex-vector.cpp :language: c++ :dedent: 8 :start-after: insert/start :end-before: insert/end

Definition at line 379 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::drop(), immer::flex_vector< T, MemoryPolicy, B, BL >::push_back(), and immer::flex_vector< T, MemoryPolicy, B, BL >::take().

◆ insert() [2/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) immer::flex_vector< T, MemoryPolicy, B, BL >::insert ( size_type  pos,
value 
) &&
inline

◆ insert() [3/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::insert ( size_type  pos,
flex_vector< T, MemoryPolicy, B, BL >  value 
) const &
inline

◆ insert() [4/4]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) immer::flex_vector< T, MemoryPolicy, B, BL >::insert ( size_type  pos,
flex_vector< T, MemoryPolicy, B, BL >  value 
) &&
inline

◆ operator!=()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
bool immer::flex_vector< T, MemoryPolicy, B, BL >::operator!= ( const flex_vector< T, MemoryPolicy, B, BL > &  other) const
inline

Definition at line 199 of file flex_vector.hpp.

◆ operator+() [1/3]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) friend immer::flex_vector< T, MemoryPolicy, B, BL >::operator+ ( flex_vector< T, MemoryPolicy, B, BL > &&  l,
const flex_vector< T, MemoryPolicy, B, BL > &  r 
)
inline

◆ operator+() [2/3]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) friend immer::flex_vector< T, MemoryPolicy, B, BL >::operator+ ( const flex_vector< T, MemoryPolicy, B, BL > &  l,
flex_vector< T, MemoryPolicy, B, BL > &&  r 
)
inline

◆ operator+() [3/3]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) friend immer::flex_vector< T, MemoryPolicy, B, BL >::operator+ ( flex_vector< T, MemoryPolicy, B, BL > &&  l,
flex_vector< T, MemoryPolicy, B, BL > &&  r 
)
inline

◆ operator==()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
bool immer::flex_vector< T, MemoryPolicy, B, BL >::operator== ( const flex_vector< T, MemoryPolicy, B, BL > &  other) const
inline

Returns whether the vectors are equal.

Definition at line 197 of file flex_vector.hpp.

References immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::equals(), and immer::flex_vector< T, MemoryPolicy, B, BL >::impl_.

◆ operator[]()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
reference immer::flex_vector< T, MemoryPolicy, B, BL >::operator[] ( size_type  index) const
inline

Returns a const reference to the element at position index. It is undefined when $ 0 index \geq size() $. It does not allocate memory and its complexity is effectively $ O(1) $.

Definition at line 182 of file flex_vector.hpp.

References immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::get(), and immer::flex_vector< T, MemoryPolicy, B, BL >::impl_.

◆ push_back() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::push_back ( value_type  value) const &
inline

Returns a flex_vector with value inserted at the end. It may allocate memory and its complexity is effectively $ O(1) $.

Example .. literalinclude:: ../example/flex-vector/flex-vector.cpp :language: c++ :dedent: 8 :start-after: push-back/start :end-before: push-back/end

Definition at line 217 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::impl_, and immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::push_back().

Referenced by immer::flex_vector< T, MemoryPolicy, B, BL >::insert(), and immer::flex_vector< T, MemoryPolicy, B, BL >::push_front().

◆ push_back() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) immer::flex_vector< T, MemoryPolicy, B, BL >::push_back ( value_type  value) &&
inline

◆ push_back_move() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector&& immer::flex_vector< T, MemoryPolicy, B, BL >::push_back_move ( std::true_type  ,
value_type  value 
)
inlineprivate

◆ push_back_move() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::push_back_move ( std::false_type  ,
value_type  value 
)
inlineprivate

◆ push_front()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::push_front ( value_type  value) const
inline

Returns a flex_vector with value inserted at the frony. It may allocate memory and its complexity is $ O(log(size)) $.

Example .. literalinclude:: ../example/flex-vector/flex-vector.cpp :language: c++ :dedent: 8 :start-after: push-front/start :end-before: push-front/end

Definition at line 238 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::push_back().

◆ rbegin()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
reverse_iterator immer::flex_vector< T, MemoryPolicy, B, BL >::rbegin ( ) const
inline

Returns an iterator that traverses the collection backwards, pointing at the first element of the reversed collection. It does not allocate memory and its complexity is $ O(1) $.

Definition at line 145 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::end().

◆ rend()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
reverse_iterator immer::flex_vector< T, MemoryPolicy, B, BL >::rend ( ) const
inline

Returns an iterator that traverses the collection backwards, pointing after the last element of the reversed collection. It does not allocate memory and its complexity is $ O(1) $.

Definition at line 152 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::begin().

◆ set() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::set ( size_type  index,
value_type  value 
) const &
inline

Returns a flex_vector containing value value at position index. Undefined for index >= size(). It may allocate memory and its complexity is effectively $ O(1) $.

Example .. literalinclude:: ../example/flex-vector/flex-vector.cpp :language: c++ :dedent: 8 :start-after: set/start :end-before: set/end

Definition at line 258 of file flex_vector.hpp.

References immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::assoc(), and immer::flex_vector< T, MemoryPolicy, B, BL >::impl_.

◆ set() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) immer::flex_vector< T, MemoryPolicy, B, BL >::set ( size_type  index,
value_type  value 
) &&
inline

◆ set_move() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector&& immer::flex_vector< T, MemoryPolicy, B, BL >::set_move ( std::true_type  ,
size_type  index,
value_type  value 
)
inlineprivate

◆ set_move() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::set_move ( std::false_type  ,
size_type  index,
value_type  value 
)
inlineprivate

◆ size()

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
size_type immer::flex_vector< T, MemoryPolicy, B, BL >::size ( ) const
inline

Returns the number of elements in the container. It does not allocate memory and its complexity is $ O(1) $.

Definition at line 158 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::impl_, and immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::size.

◆ take() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::take ( size_type  elems) const &
inline

Returns a vector containing only the first min(elems, size()) elements. It may allocate memory and its complexity is effectively $ O(1) $.

Example .. literalinclude:: ../example/flex-vector/flex-vector.cpp :language: c++ :dedent: 8 :start-after: take/start :end-before: take/end

Definition at line 307 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::impl_, and immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::take().

Referenced by immer::flex_vector< T, MemoryPolicy, B, BL >::erase(), and immer::flex_vector< T, MemoryPolicy, B, BL >::insert().

◆ take() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
decltype(auto) immer::flex_vector< T, MemoryPolicy, B, BL >::take ( size_type  elems) &&
inline

◆ take_move() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector&& immer::flex_vector< T, MemoryPolicy, B, BL >::take_move ( std::true_type  ,
size_type  elems 
)
inlineprivate

◆ take_move() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::take_move ( std::false_type  ,
size_type  elems 
)
inlineprivate

◆ transient() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
transient_type immer::flex_vector< T, MemoryPolicy, B, BL >::transient ( ) const &
inline

Returns an transient form of this container, an immer::flex_vector_transient.

Definition at line 437 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::impl_.

◆ transient() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
transient_type immer::flex_vector< T, MemoryPolicy, B, BL >::transient ( ) &&
inline

◆ update() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
template<typename FnT >
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::update ( size_type  index,
FnT &&  fn 
) const &
inline

Returns a vector containing the result of the expression fn((*this)[idx]) at position idx. Undefined for index >= size(). It may allocate memory and its complexity is effectively $ O(1) $.

Example .. literalinclude:: ../example/flex-vector/flex-vector.cpp :language: c++ :dedent: 8 :start-after: update/start :end-before: update/end

Definition at line 284 of file flex_vector.hpp.

References immer::flex_vector< T, MemoryPolicy, B, BL >::impl_, and immer::detail::rbts::rrbtree< T, MemoryPolicy, B, BL >::update().

◆ update() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
template<typename FnT >
decltype(auto) immer::flex_vector< T, MemoryPolicy, B, BL >::update ( size_type  index,
FnT &&  fn 
) &&
inline

◆ update_move() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
template<typename Fn >
flex_vector&& immer::flex_vector< T, MemoryPolicy, B, BL >::update_move ( std::true_type  ,
size_type  index,
Fn &&  fn 
)
inlineprivate

◆ update_move() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
template<typename Fn >
flex_vector immer::flex_vector< T, MemoryPolicy, B, BL >::update_move ( std::false_type  ,
size_type  index,
Fn &&  fn 
)
inlineprivate

Friends And Related Function Documentation

◆ operator+

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
flex_vector operator+ ( const flex_vector< T, MemoryPolicy, B, BL > &  l,
const flex_vector< T, MemoryPolicy, B, BL > &  r 
)
friend

Concatenation operator. Returns a flex_vector with the contents of l followed by those of r. It may allocate memory and its complexity is $ O(log(max(size_r, size_l))) $

Example .. literalinclude:: ../example/flex-vector/flex-vector.cpp :language: c++ :dedent: 8 :start-after: concat/start :end-before: concat/end

Definition at line 351 of file flex_vector.hpp.

Member Data Documentation

◆ bits

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
constexpr auto immer::flex_vector< T, MemoryPolicy, B, BL >::bits = B
static

Definition at line 69 of file flex_vector.hpp.

◆ bits_leaf

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
constexpr auto immer::flex_vector< T, MemoryPolicy, B, BL >::bits_leaf = BL
static

Definition at line 70 of file flex_vector.hpp.

◆ impl_

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
impl_t immer::flex_vector< T, MemoryPolicy, B, BL >::impl_ = impl_t::empty()
private

◆ transient_type

template<typename T , typename MemoryPolicy = default_memory_policy, detail::rbts::bits_t B = default_bits, detail::rbts::bits_t BL = detail::rbts::derive_bits_leaf<T, MemoryPolicy, B>>
friend immer::flex_vector< T, MemoryPolicy, B, BL >::transient_type
private

Definition at line 451 of file flex_vector.hpp.


The documentation for this class was generated from the following file:
Released under the MIT license