Low-Level Abstraction of Memory Access
llama::ScopedUpdate< Reference, typename > Struct Template Reference

#include <RecordRef.hpp>

+ Inheritance diagram for llama::ScopedUpdate< Reference, typename >:
+ Collaboration diagram for llama::ScopedUpdate< Reference, typename >:

Public Types

using value_type = typename internal::ValueOf< Reference >::type
 

Public Member Functions

 ScopedUpdate (Reference r)
 Loads a copy of the value referenced by r. Stores r and the loaded value. More...
 
 ScopedUpdate (const ScopedUpdate &)=delete
 
auto operator= (const ScopedUpdate &) -> ScopedUpdate &=delete
 
 ScopedUpdate (ScopedUpdate &&) noexcept=default
 
auto operator= (ScopedUpdate &&) noexcept -> ScopedUpdate &=default
 
 ~ScopedUpdate ()
 Stores the internally stored value back to the referenced value. More...
 
auto get () -> value_type &
 Get access to the stored value. More...
 
auto get () const -> const value_type &
 Get access to the stored value. More...
 

Detailed Description

template<typename Reference, typename = void>
struct llama::ScopedUpdate< Reference, typename >

Scope guard type. ScopedUpdate takes a copy of a value through a reference and stores it internally during construction. The stored value is written back when ScopedUpdate is destroyed. ScopedUpdate tries to act like the stored value as much as possible, exposing member functions of the stored value and acting like a proxy reference if the stored value is a primitive type.

Definition at line 888 of file RecordRef.hpp.

Member Typedef Documentation

◆ value_type

template<typename Reference , typename = void>
using llama::ScopedUpdate< Reference, typename >::value_type = typename internal::ValueOf<Reference>::type

Definition at line 890 of file RecordRef.hpp.

Constructor & Destructor Documentation

◆ ScopedUpdate() [1/3]

template<typename Reference , typename = void>
llama::ScopedUpdate< Reference, typename >::ScopedUpdate ( Reference  r)
inlineexplicit

Loads a copy of the value referenced by r. Stores r and the loaded value.

Definition at line 893 of file RecordRef.hpp.

◆ ScopedUpdate() [2/3]

template<typename Reference , typename = void>
llama::ScopedUpdate< Reference, typename >::ScopedUpdate ( const ScopedUpdate< Reference, typename > &  )
delete

◆ ScopedUpdate() [3/3]

template<typename Reference , typename = void>
llama::ScopedUpdate< Reference, typename >::ScopedUpdate ( ScopedUpdate< Reference, typename > &&  )
defaultnoexcept

◆ ~ScopedUpdate()

template<typename Reference , typename = void>
llama::ScopedUpdate< Reference, typename >::~ScopedUpdate ( )
inline

Stores the internally stored value back to the referenced value.

Definition at line 906 of file RecordRef.hpp.

Member Function Documentation

◆ get() [1/2]

template<typename Reference , typename = void>
auto llama::ScopedUpdate< Reference, typename >::get ( ) -> value_type&
inline

Get access to the stored value.

Definition at line 912 of file RecordRef.hpp.

◆ get() [2/2]

template<typename Reference , typename = void>
auto llama::ScopedUpdate< Reference, typename >::get ( ) const -> const value_type&
inline

Get access to the stored value.

Definition at line 918 of file RecordRef.hpp.

◆ operator=() [1/2]

template<typename Reference , typename = void>
auto llama::ScopedUpdate< Reference, typename >::operator= ( const ScopedUpdate< Reference, typename > &  ) -> ScopedUpdate &=delete
delete

◆ operator=() [2/2]

template<typename Reference , typename = void>
auto llama::ScopedUpdate< Reference, typename >::operator= ( ScopedUpdate< Reference, typename > &&  ) -> ScopedUpdate &=default
defaultnoexcept

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