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, 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 387 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 391 of file Util.h.

References old_value, and var.

Referenced by ScopedValue(), and ScopedValue().

## 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 395 of file Util.h.

References old_value, and var.

## ~ScopedValue()

template<typename T>

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

inline

Definition at line 399 of file Util.h.

References old_value, and var.

## ScopedValue() [3/4]

template<typename T>

Halide::Internal::ScopedValue< T >::ScopedValue | ( | const ScopedValue< T > & | that | ) |

delete

References ScopedValue().

## ScopedValue() [4/4]

template<typename T>

Halide::Internal::ScopedValue< T >::ScopedValue | ( | ScopedValue< T > && | that | ) |

default noexcept

References ScopedValue().

## Member Function Documentation

## operator T()

template<typename T>

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

inline

Definition at line 402 of file Util.h.

References old_value.

## Member Data Documentation

## var

template<typename T>

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

Definition at line 388 of file Util.h.

Referenced by ScopedValue(), ScopedValue(), and ~ScopedValue().

## old_value

template<typename T>

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

Definition at line 389 of file Util.h.

Referenced by operator T(), ScopedValue(), ScopedValue(), and ~ScopedValue().

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

- src/Util.h