Halide 22.0.0 Halide compiler and libraries

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
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, const 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
T | 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 394 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 398 of file Util.h.

## ◆ ScopedValue() [2/4]

template<typename T >

Halide::Internal::ScopedValue< T >::ScopedValue | ( | T & | var,
|  | const T & | new_value
| ) |  |
| inline

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

Definition at line 402 of file Util.h.

References Halide::cast(), and Halide::Internal::ScopedValue< T >::var.

## ◆ ~ScopedValue()

template<typename T >

Halide::Internal::ScopedValue< T >::~ScopedValue | ( |  | ) |
| inline

Definition at line 406 of file Util.h.

References Halide::Internal::ScopedValue< T >::old_value, and Halide::Internal::ScopedValue< T >::var.

## ◆ 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 | ) |
| default noexcept

## Member Function Documentation

## ◆ operator T()

template<typename T >

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

Definition at line 409 of file Util.h.

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

## Member Data Documentation

## ◆ var

template<typename T >

T& Halide::Internal::ScopedValue< T >::var

Definition at line 395 of file Util.h.

Referenced by Halide::Internal::ScopedValue< T >::ScopedValue(), and Halide::Internal::ScopedValue< T >::~ScopedValue().

## ◆ old_value

template<typename T >

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

Definition at line 396 of file Util.h.

Referenced by Halide::Internal::ScopedValue< T >::operator T(), and Halide::Internal::ScopedValue< T >::~ScopedValue().

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

- src/Util.h