Halide
Halide::Internal::ScopedValue< T > Struct Template Reference

Helper class for saving/restoring variable values on the stack, to allow for early-exit that preserves correctness. More...

#include <Util.h>

Public Member Functions

 ScopedValue (T &var)
 Preserve the old value, restored at dtor time. More...
 
 ScopedValue (T &var, T new_value)
 Preserve the old value, then set the var to a new value. More...
 
 ~ScopedValue ()
 
 operator T () const
 
 ScopedValue (const ScopedValue &that)=delete
 
 ScopedValue (ScopedValue &&that) noexcept=default
 

Public Attributes

T & var
 
old_value
 

Detailed Description

template<typename T>
struct Halide::Internal::ScopedValue< T >

Helper class for saving/restoring variable values on the stack, to allow for early-exit that preserves correctness.

Definition at line 325 of file Util.h.

Constructor & Destructor Documentation

◆ ScopedValue() [1/4]

template<typename T >
Halide::Internal::ScopedValue< T >::ScopedValue ( T &  var)
inline

Preserve the old value, restored at dtor time.

Definition at line 329 of file Util.h.

◆ ScopedValue() [2/4]

template<typename T >
Halide::Internal::ScopedValue< T >::ScopedValue ( T &  var,
new_value 
)
inline

Preserve the old value, then set the var to a new value.

Definition at line 333 of file Util.h.

References Halide::Internal::ScopedValue< T >::var.

◆ ~ScopedValue()

template<typename T >
Halide::Internal::ScopedValue< T >::~ScopedValue ( )
inline

◆ ScopedValue() [3/4]

template<typename T >
Halide::Internal::ScopedValue< T >::ScopedValue ( const ScopedValue< T > &  that)
delete

◆ ScopedValue() [4/4]

template<typename T >
Halide::Internal::ScopedValue< T >::ScopedValue ( ScopedValue< T > &&  that)
defaultnoexcept

Member Function Documentation

◆ operator T()

template<typename T >
Halide::Internal::ScopedValue< T >::operator T ( ) const
inline

Definition at line 340 of file Util.h.

References Halide::Internal::ScopedValue< T >::old_value.

Member Data Documentation

◆ var

◆ old_value

template<typename T >
T Halide::Internal::ScopedValue< T >::old_value

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