Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
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.
 
 ScopedValue (T &var, T new_value)
 Preserve the old value, then set the var to a new value.
 
 ~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 383 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 387 of file Util.h.

◆ ScopedValue() [2/4]

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

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

Definition at line 391 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 398 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: