Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

immer::array_transient< T, MemoryPolicy > Class Template Reference

#include <array.hpp>

+ Inheritance diagram for immer::array_transient< T, MemoryPolicy >:
+ Collaboration diagram for immer::array_transient< T, MemoryPolicy >:

Public Types

using value_type = T
 
using reference = const T &
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using const_reference = const T &
 
using iterator = const T *
 
using const_iterator = iterator
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using memory_policy = MemoryPolicy
 
using persistent_type = array< T, MemoryPolicy >
 

Public Member Functions

 array_transient ()=default
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
std::size_t size () const
 
bool empty () const
 
const T * data () const
 
const T & back () const
 
const T & front () 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 () &&
 

Private Types

using impl_t = detail::arrays::with_capacity< T, MemoryPolicy >
 
using impl_no_capacity_t = detail::arrays::no_capacity< T, MemoryPolicy >
 
using owner_t = typename MemoryPolicy::transience_t::owner
 

Private Member Functions

 array_transient (impl_t impl)
 

Private Attributes

friend persistent_type
 
impl_t impl_ = impl_t::empty
 

Detailed Description

template<typename T, typename MemoryPolicy = default_memory_policy>
class immer::array_transient< T, MemoryPolicy >

Mutable version of immer::array.

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

Definition at line 17 of file array.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::const_iterator = iterator

Definition at line 45 of file array_transient.hpp.

◆ const_reference

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::const_reference = const T&

Definition at line 42 of file array_transient.hpp.

◆ difference_type

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::difference_type = std::ptrdiff_t

Definition at line 41 of file array_transient.hpp.

◆ impl_no_capacity_t

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::impl_no_capacity_t = detail::arrays::no_capacity<T, MemoryPolicy>
private

Definition at line 34 of file array_transient.hpp.

◆ impl_t

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::impl_t = detail::arrays::with_capacity<T, MemoryPolicy>
private

Definition at line 33 of file array_transient.hpp.

◆ iterator

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::iterator = const T*

Definition at line 44 of file array_transient.hpp.

◆ memory_policy

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::memory_policy = MemoryPolicy

Definition at line 48 of file array_transient.hpp.

◆ owner_t

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::owner_t = typename MemoryPolicy::transience_t::owner
private

Definition at line 35 of file array_transient.hpp.

◆ persistent_type

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::persistent_type = array<T, MemoryPolicy>

Definition at line 49 of file array_transient.hpp.

◆ reference

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::reference = const T&

Definition at line 39 of file array_transient.hpp.

◆ reverse_iterator

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 46 of file array_transient.hpp.

◆ size_type

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::size_type = std::size_t

Definition at line 40 of file array_transient.hpp.

◆ value_type

template<typename T , typename MemoryPolicy = default_memory_policy>
using immer::array_transient< T, MemoryPolicy >::value_type = T

Definition at line 38 of file array_transient.hpp.

Constructor & Destructor Documentation

◆ array_transient() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy>
immer::array_transient< T, MemoryPolicy >::array_transient ( )
default

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

◆ array_transient() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy>
immer::array_transient< T, MemoryPolicy >::array_transient ( impl_t  impl)
inlineprivate

Definition at line 180 of file array_transient.hpp.

Member Function Documentation

◆ at()

template<typename T , typename MemoryPolicy = default_memory_policy>
reference immer::array_transient< T, MemoryPolicy >::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 127 of file array_transient.hpp.

References immer::detail::arrays::with_capacity< T, MemoryPolicy >::get_check(), and immer::array_transient< T, MemoryPolicy >::impl_.

◆ back()

template<typename T , typename MemoryPolicy = default_memory_policy>
const T& immer::array_transient< T, MemoryPolicy >::back ( ) const
inline

◆ begin()

template<typename T , typename MemoryPolicy = default_memory_policy>
iterator immer::array_transient< T, MemoryPolicy >::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 63 of file array_transient.hpp.

References immer::detail::arrays::with_capacity< T, MemoryPolicy >::data(), and immer::array_transient< T, MemoryPolicy >::impl_.

Referenced by immer::array_transient< T, MemoryPolicy >::rend().

◆ data()

template<typename T , typename MemoryPolicy = default_memory_policy>
const T* immer::array_transient< T, MemoryPolicy >::data ( ) const
inline

◆ empty()

template<typename T , typename MemoryPolicy = default_memory_policy>
bool immer::array_transient< T, MemoryPolicy >::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 95 of file array_transient.hpp.

References immer::detail::arrays::with_capacity< T, MemoryPolicy >::empty(), and immer::array_transient< T, MemoryPolicy >::impl_.

◆ end()

template<typename T , typename MemoryPolicy = default_memory_policy>
iterator immer::array_transient< T, MemoryPolicy >::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 69 of file array_transient.hpp.

References immer::detail::arrays::with_capacity< T, MemoryPolicy >::data(), immer::array_transient< T, MemoryPolicy >::impl_, and immer::detail::arrays::with_capacity< T, MemoryPolicy >::size.

Referenced by immer::array_transient< T, MemoryPolicy >::rbegin().

◆ front()

template<typename T , typename MemoryPolicy = default_memory_policy>
const T& immer::array_transient< T, MemoryPolicy >::front ( ) const
inline

Access the first element.

Definition at line 110 of file array_transient.hpp.

References immer::array_transient< T, MemoryPolicy >::data().

◆ operator[]()

template<typename T , typename MemoryPolicy = default_memory_policy>
reference immer::array_transient< T, MemoryPolicy >::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 118 of file array_transient.hpp.

References immer::detail::arrays::with_capacity< T, MemoryPolicy >::get(), and immer::array_transient< T, MemoryPolicy >::impl_.

◆ persistent() [1/2]

template<typename T , typename MemoryPolicy = default_memory_policy>
persistent_type immer::array_transient< T, MemoryPolicy >::persistent ( ) &
inline

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

Definition at line 169 of file array_transient.hpp.

References immer::array_transient< T, MemoryPolicy >::impl_.

◆ persistent() [2/2]

template<typename T , typename MemoryPolicy = default_memory_policy>
persistent_type immer::array_transient< T, MemoryPolicy >::persistent ( ) &&
inline

◆ push_back()

template<typename T , typename MemoryPolicy = default_memory_policy>
void immer::array_transient< T, MemoryPolicy >::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 134 of file array_transient.hpp.

References immer::array_transient< T, MemoryPolicy >::impl_, and immer::detail::arrays::with_capacity< T, MemoryPolicy >::push_back_mut().

◆ rbegin()

template<typename T , typename MemoryPolicy = default_memory_policy>
reverse_iterator immer::array_transient< T, MemoryPolicy >::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 76 of file array_transient.hpp.

References immer::array_transient< T, MemoryPolicy >::end().

◆ rend()

template<typename T , typename MemoryPolicy = default_memory_policy>
reverse_iterator immer::array_transient< T, MemoryPolicy >::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 83 of file array_transient.hpp.

References immer::array_transient< T, MemoryPolicy >::begin().

◆ set()

template<typename T , typename MemoryPolicy = default_memory_policy>
void immer::array_transient< T, MemoryPolicy >::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 143 of file array_transient.hpp.

References immer::detail::arrays::with_capacity< T, MemoryPolicy >::assoc_mut(), and immer::array_transient< T, MemoryPolicy >::impl_.

◆ size()

template<typename T , typename MemoryPolicy = default_memory_policy>
std::size_t immer::array_transient< T, MemoryPolicy >::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 89 of file array_transient.hpp.

References immer::array_transient< T, MemoryPolicy >::impl_, and immer::detail::arrays::with_capacity< T, MemoryPolicy >::size.

Referenced by immer::array_transient< T, MemoryPolicy >::back().

◆ take()

template<typename T , typename MemoryPolicy = default_memory_policy>
void immer::array_transient< T, MemoryPolicy >::take ( size_type  elems)
inline

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

Definition at line 162 of file array_transient.hpp.

References immer::array_transient< T, MemoryPolicy >::impl_, and immer::detail::arrays::with_capacity< T, MemoryPolicy >::take_mut().

◆ update()

template<typename T , typename MemoryPolicy = default_memory_policy>
template<typename FnT >
void immer::array_transient< T, MemoryPolicy >::update ( size_type  index,
FnT &&  fn 
)
inline

Updates the array 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 154 of file array_transient.hpp.

References immer::array_transient< T, MemoryPolicy >::impl_, and immer::detail::arrays::with_capacity< T, MemoryPolicy >::update_mut().

Member Data Documentation

◆ impl_

◆ persistent_type

template<typename T , typename MemoryPolicy = default_memory_policy>
friend immer::array_transient< T, MemoryPolicy >::persistent_type
private

Definition at line 178 of file array_transient.hpp.


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