Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

#include <box.hpp>

+ Collaboration diagram for immer::box< T, MemoryPolicy >:

Classes

struct  holder
 

Public Types

using value_type = T
 
using memory_policy = MemoryPolicy
 

Public Member Functions

 box ()
 
template<typename Arg , typename Enable = std::enable_if_t< !std::is_same<box, std::decay_t<Arg>>::value && std::is_constructible<T, Arg>::value>>
 box (Arg &&arg)
 
template<typename Arg1 , typename Arg2 , typename... Args>
 box (Arg1 &&arg1, Arg2 &&arg2, Args &&...args)
 
 box (box &&other)
 
 box (const box &other)
 
boxoperator= (box &&other)
 
boxoperator= (const box &other)
 
 ~box ()
 
const T & get () const
 
 operator const T & () const
 
const T & operator* () const
 
const T * operator-> () const
 
bool operator== (detail::exact_t< const box &> other) const
 
bool operator!= (detail::exact_t< const box &> other) const
 
bool operator< (detail::exact_t< const box &> other) const
 
template<typename Fn >
box update (Fn &&fn) const &
 
template<typename Fn >
box && update (Fn &&fn) &&
 

Private Types

using heap = typename MemoryPolicy::heap::type
 

Private Member Functions

 box (holder *impl)
 

Private Attributes

holderimpl_ = nullptr
 

Friends

struct detail::gc_atom_impl< T, MemoryPolicy >
 
struct detail::refcount_atom_impl< T, MemoryPolicy >
 
void swap (box &a, box &b)
 

Detailed Description

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

Immutable box for a single value of type T.

The box is always copiable and movable. The T copy or move operations are never called. Since a box is immutable, copying or moving just copy the underlying pointers.

Definition at line 35 of file box.hpp.

Member Typedef Documentation

◆ heap

template<typename T, typename MemoryPolicy = default_memory_policy>
using immer::box< T, MemoryPolicy >::heap = typename MemoryPolicy::heap::type
private

Definition at line 48 of file box.hpp.

◆ memory_policy

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

Definition at line 56 of file box.hpp.

◆ value_type

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

Definition at line 55 of file box.hpp.

Constructor & Destructor Documentation

◆ box() [1/6]

template<typename T, typename MemoryPolicy = default_memory_policy>
immer::box< T, MemoryPolicy >::box ( holder impl)
inlineprivate

Definition at line 52 of file box.hpp.

◆ box() [2/6]

template<typename T, typename MemoryPolicy = default_memory_policy>
immer::box< T, MemoryPolicy >::box ( )
inline

Constructs a box holding T{}.

Definition at line 61 of file box.hpp.

◆ box() [3/6]

template<typename T, typename MemoryPolicy = default_memory_policy>
template<typename Arg , typename Enable = std::enable_if_t< !std::is_same<box, std::decay_t<Arg>>::value && std::is_constructible<T, Arg>::value>>
immer::box< T, MemoryPolicy >::box ( Arg &&  arg)
inline

Constructs a box holding T{arg}

Definition at line 70 of file box.hpp.

◆ box() [4/6]

template<typename T, typename MemoryPolicy = default_memory_policy>
template<typename Arg1 , typename Arg2 , typename... Args>
immer::box< T, MemoryPolicy >::box ( Arg1 &&  arg1,
Arg2 &&  arg2,
Args &&...  args 
)
inline

Constructs a box holding T{arg1, arg2, args...}

Definition at line 77 of file box.hpp.

◆ box() [5/6]

template<typename T, typename MemoryPolicy = default_memory_policy>
immer::box< T, MemoryPolicy >::box ( box< T, MemoryPolicy > &&  other)
inline

Definition at line 87 of file box.hpp.

References immer::box< T, MemoryPolicy >::swap.

◆ box() [6/6]

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

Definition at line 88 of file box.hpp.

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

◆ ~box()

template<typename T, typename MemoryPolicy = default_memory_policy>
immer::box< T, MemoryPolicy >::~box ( )
inline

Definition at line 96 of file box.hpp.

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

Member Function Documentation

◆ get()

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

Query the current value.

Definition at line 105 of file box.hpp.

References immer::box< T, MemoryPolicy >::impl_, and immer::box< T, MemoryPolicy >::holder::value.

◆ operator const T &()

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

Conversion to the boxed type.

Definition at line 108 of file box.hpp.

◆ operator!=()

template<typename T, typename MemoryPolicy = default_memory_policy>
bool immer::box< T, MemoryPolicy >::operator!= ( detail::exact_t< const box< T, MemoryPolicy > &>  other) const
inline

Definition at line 123 of file box.hpp.

References immer::detail::exact_t< T >::value.

◆ operator*()

template<typename T, typename MemoryPolicy = default_memory_policy>
const T& immer::box< T, MemoryPolicy >::operator* ( ) const
inline

Access via dereference

Definition at line 111 of file box.hpp.

◆ operator->()

template<typename T, typename MemoryPolicy = default_memory_policy>
const T* immer::box< T, MemoryPolicy >::operator-> ( ) const
inline

Access via pointer member access

Definition at line 114 of file box.hpp.

◆ operator<()

template<typename T, typename MemoryPolicy = default_memory_policy>
bool immer::box< T, MemoryPolicy >::operator< ( detail::exact_t< const box< T, MemoryPolicy > &>  other) const
inline

Definition at line 125 of file box.hpp.

◆ operator=() [1/2]

template<typename T, typename MemoryPolicy = default_memory_policy>
box& immer::box< T, MemoryPolicy >::operator= ( box< T, MemoryPolicy > &&  other)
inline

Definition at line 89 of file box.hpp.

References immer::box< T, MemoryPolicy >::swap.

◆ operator=() [2/2]

template<typename T, typename MemoryPolicy = default_memory_policy>
box& immer::box< T, MemoryPolicy >::operator= ( const box< T, MemoryPolicy > &  other)
inline

Definition at line 90 of file box.hpp.

References immer::box< T, MemoryPolicy >::swap.

◆ operator==()

template<typename T, typename MemoryPolicy = default_memory_policy>
bool immer::box< T, MemoryPolicy >::operator== ( detail::exact_t< const box< T, MemoryPolicy > &>  other) const
inline

Comparison.

Definition at line 117 of file box.hpp.

References immer::box< T, MemoryPolicy >::impl_, and immer::detail::exact_t< T >::value.

◆ update() [1/2]

template<typename T, typename MemoryPolicy = default_memory_policy>
template<typename Fn >
box immer::box< T, MemoryPolicy >::update ( Fn &&  fn) const &
inline

Returns a new box built by applying the fn to the underlying value.

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

Definition at line 144 of file box.hpp.

◆ update() [2/2]

template<typename T, typename MemoryPolicy = default_memory_policy>
template<typename Fn >
box&& immer::box< T, MemoryPolicy >::update ( Fn &&  fn) &&
inline

Friends And Related Function Documentation

◆ detail::gc_atom_impl< T, MemoryPolicy >

template<typename T, typename MemoryPolicy = default_memory_policy>
friend struct detail::gc_atom_impl< T, MemoryPolicy >
friend

Definition at line 37 of file box.hpp.

◆ detail::refcount_atom_impl< T, MemoryPolicy >

template<typename T, typename MemoryPolicy = default_memory_policy>
friend struct detail::refcount_atom_impl< T, MemoryPolicy >
friend

Definition at line 38 of file box.hpp.

◆ swap

template<typename T, typename MemoryPolicy = default_memory_policy>
void swap ( box< T, MemoryPolicy > &  a,
box< T, MemoryPolicy > &  b 
)
friend

Member Data Documentation

◆ impl_


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