Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
base::AutoReset< T > Class Template Reference

#include <auto_reset.h>

Public Member Functions

template<typename U >
 AutoReset (T *scoped_variable, U &&new_value)
 
 AutoReset (AutoReset &&other)
 
AutoResetoperator= (AutoReset &&rhs)
 
 ~AutoReset ()
 

Detailed Description

template<typename T>
class base::AutoReset< T >

Definition at line 22 of file auto_reset.h.

Constructor & Destructor Documentation

◆ AutoReset() [1/2]

template<typename T >
template<typename U >
base::AutoReset< T >::AutoReset ( T scoped_variable,
U &&  new_value 
)
inline

Definition at line 25 of file auto_reset.h.

26 : scoped_variable_(scoped_variable),
27 original_value_(
28 std::exchange(*scoped_variable_, std::forward<U>(new_value))) {}

◆ AutoReset() [2/2]

template<typename T >
base::AutoReset< T >::AutoReset ( AutoReset< T > &&  other)
inline

Definition at line 30 of file auto_reset.h.

31 : scoped_variable_(std::exchange(other.scoped_variable_, nullptr)),
32 original_value_(std::move(other.original_value_)) {}

◆ ~AutoReset()

template<typename T >
base::AutoReset< T >::~AutoReset ( )
inline

Definition at line 40 of file auto_reset.h.

40 {
41 if (scoped_variable_)
42 *scoped_variable_ = std::move(original_value_);
43 }

Member Function Documentation

◆ operator=()

template<typename T >
AutoReset & base::AutoReset< T >::operator= ( AutoReset< T > &&  rhs)
inline

Definition at line 34 of file auto_reset.h.

34 {
35 scoped_variable_ = std::exchange(rhs.scoped_variable_, nullptr);
36 original_value_ = std::move(rhs.original_value_);
37 return *this;
38 }

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