Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

immer::vector_transient< T, MemoryPolicy, B, BL > Class Template Reference

#include <flex_vector_transient.hpp>

+ Inheritance diagram for immer::vector_transient< T, MemoryPolicy, B, BL >:
+ Collaboration diagram for immer::vector_transient< T, MemoryPolicy, B, BL >:

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::rbtree_iterator< T, MemoryPolicy, B, BL >
 
using const_iterator = iterator
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using persistent_type = vector< T, MemoryPolicy, B, BL >
 

Public Member Functions

 vector_transient ()=default
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
size_type size () const
 
bool empty () const
 
reference operator[] (size_type index) const
 
reference at (size_type index) const
 
void push_back (value_type value)
 
void set (size_type index, value_type value)
 
template<typename FnT >
void update (size_type index, FnT &&fn)
 
void take (size_type elems)
 
persistent_type persistent () &
 
persistent_type persistent () &&
 

Static Public Attributes

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

Private Types

using impl_t = detail::rbts::rbtree< T, MemoryPolicy, B, BL >
 
using flex_t = flex_vector_transient< T, MemoryPolicy, B, BL >
 
using owner_t = typename MemoryPolicy::transience_t::owner
 

Private Member Functions

 vector_transient (impl_t impl)
 

Private Attributes

friend flex_t
 
friend persistent_type
 
impl_t impl_ = impl_t::empty()
 

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::vector_transient< T, MemoryPolicy, B, BL >

Mutable version of immer::vector.

Refer to :doc:transients to learn more about when and how to use the mutable versions of immutable containers.

Definition at line 27 of file flex_vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::const_iterator = iterator

Definition at line 62 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::const_reference = const T&

Definition at line 59 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::difference_type = std::ptrdiff_t

Definition at line 58 of file vector_transient.hpp.

◆ flex_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::vector_transient< T, MemoryPolicy, B, BL >::flex_t = flex_vector_transient<T, MemoryPolicy, B, BL>
private

Definition at line 47 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::impl_t = detail::rbts::rbtree<T, MemoryPolicy, B, BL>
private

Definition at line 46 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::iterator = detail::rbts::rbtree_iterator<T, MemoryPolicy, B, BL>

Definition at line 61 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::memory_policy = MemoryPolicy

Definition at line 53 of file vector_transient.hpp.

◆ owner_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::vector_transient< T, MemoryPolicy, B, BL >::owner_t = typename MemoryPolicy::transience_t::owner
private

Definition at line 48 of file vector_transient.hpp.

◆ persistent_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::vector_transient< T, MemoryPolicy, B, BL >::persistent_type = vector<T, MemoryPolicy, B, BL>

Definition at line 65 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::reference = const T&

Definition at line 56 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 63 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::size_type = detail::rbts::size_t

Definition at line 57 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::value_type = T

Definition at line 55 of file vector_transient.hpp.

Constructor & Destructor Documentation

◆ vector_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>>
immer::vector_transient< T, MemoryPolicy, B, BL >::vector_transient ( )
default

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

◆ vector_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>>
immer::vector_transient< T, MemoryPolicy, B, BL >::vector_transient ( impl_t  impl)
inlineprivate

Definition at line 182 of file vector_transient.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::vector_transient< 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 128 of file vector_transient.hpp.

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

◆ 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::vector_transient< 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 79 of file vector_transient.hpp.

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

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

◆ 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::vector_transient< 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 111 of file vector_transient.hpp.

References immer::vector_transient< T, MemoryPolicy, B, BL >::impl_, and immer::detail::rbts::rbtree< 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::vector_transient< 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 85 of file vector_transient.hpp.

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

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

◆ 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::vector_transient< 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 119 of file vector_transient.hpp.

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

◆ persistent() [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>>
persistent_type immer::vector_transient< T, MemoryPolicy, B, BL >::persistent ( ) &
inline

Returns an immutable form of this container, an immer::vector.

Definition at line 170 of file vector_transient.hpp.

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

◆ persistent() [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>>
persistent_type immer::vector_transient< T, MemoryPolicy, B, BL >::persistent ( ) &&
inline

◆ push_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>>
void immer::vector_transient< T, MemoryPolicy, B, BL >::push_back ( value_type  value)
inline

Inserts value at the end. It may allocate memory and its complexity is effectively $ O(1) $.

Definition at line 135 of file vector_transient.hpp.

References immer::vector_transient< T, MemoryPolicy, B, BL >::impl_, and immer::detail::rbts::rbtree< T, MemoryPolicy, B, BL >::push_back_mut().

◆ 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::vector_transient< 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 92 of file vector_transient.hpp.

References immer::vector_transient< 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::vector_transient< 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 99 of file vector_transient.hpp.

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

◆ set()

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>>
void immer::vector_transient< T, MemoryPolicy, B, BL >::set ( size_type  index,
value_type  value 
)
inline

Sets to the value value at position idx. Undefined for index >= size(). It may allocate memory and its complexity is effectively $ O(1) $.

Definition at line 144 of file vector_transient.hpp.

References immer::detail::rbts::rbtree< T, MemoryPolicy, B, BL >::assoc_mut(), and immer::vector_transient< T, MemoryPolicy, B, BL >::impl_.

◆ 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::vector_transient< 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 105 of file vector_transient.hpp.

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

◆ take()

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>>
void immer::vector_transient< T, MemoryPolicy, B, BL >::take ( size_type  elems)
inline

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

Definition at line 163 of file vector_transient.hpp.

References immer::vector_transient< T, MemoryPolicy, B, BL >::impl_, and immer::detail::rbts::rbtree< T, MemoryPolicy, B, BL >::take_mut().

◆ update()

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 >
void immer::vector_transient< T, MemoryPolicy, B, BL >::update ( size_type  index,
FnT &&  fn 
)
inline

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

Definition at line 155 of file vector_transient.hpp.

References immer::vector_transient< T, MemoryPolicy, B, BL >::impl_, and immer::detail::rbts::rbtree< T, MemoryPolicy, B, BL >::update_mut().

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::vector_transient< T, MemoryPolicy, B, BL >::bits = B
static

Definition at line 51 of file vector_transient.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::vector_transient< T, MemoryPolicy, B, BL >::bits_leaf = BL
static

Definition at line 52 of file vector_transient.hpp.

◆ flex_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>>
friend immer::vector_transient< T, MemoryPolicy, B, BL >::flex_t
private

Definition at line 179 of file vector_transient.hpp.

◆ impl_

◆ persistent_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::vector_transient< T, MemoryPolicy, B, BL >::persistent_type
private

Definition at line 180 of file vector_transient.hpp.


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