Loading...
Searching...
No Matches
juce::ScopedValueSetter< ValueType > Class Template Reference

## Detailed Description

template<typename ValueType>
class juce::ScopedValueSetter< ValueType >

Helper class providing an RAII-based mechanism for temporarily setting and then re-setting a value.

E.g.

int x = 1;
{
ScopedValueSetter setter (x, 2);
// x is now 2
}
// x is now 1 again
{
ScopedValueSetter setter (x, 3, 4);
// x is now 3
}
// x is now 4
juce::ScopedValueSetter
Helper class providing an RAII-based mechanism for temporarily setting and then re-setting a value.
Definition juce_ScopedValueSetter.h:67
juce::ScopedValueSetter::ScopedValueSetter
ScopedValueSetter(ValueType &valueToSet, ValueType newValue)
Creates a ScopedValueSetter that will immediately change the specified value to the given new value,...
Definition juce_ScopedValueSetter.h:72
x
float x
Definition juce_UnityPluginInterface.h:197

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

- juce_core/containers/juce_ScopedValueSetter.h

## Public Member Functions

| ScopedValueSetter (ValueType &valueToSet, ValueType newValue)
| Creates a ScopedValueSetter that will immediately change the specified value to the given new value, and will then reset it to its original value when this object is deleted.
| ScopedValueSetter (ValueType &valueToSet, ValueType newValue, ValueType valueWhenDeleted)
| Creates a ScopedValueSetter that will immediately change the specified value to the given new value, and will then reset it to be valueWhenDeleted when this object is deleted.
| ~ScopedValueSetter ()

## Constructors and Destructors

## ScopedValueSetter() [1/2]

template<typename ValueType>

juce::ScopedValueSetter< ValueType >::ScopedValueSetter | ( | ValueType & | valueToSet,
|  | ValueType | newValue )

inline

Creates a ScopedValueSetter that will immediately change the specified value to the given new value, and will then reset it to its original value when this object is deleted.

## ScopedValueSetter() [2/2]

template<typename ValueType>

juce::ScopedValueSetter< ValueType >::ScopedValueSetter | ( | ValueType & | valueToSet,
|  | ValueType | newValue,
|  | ValueType | valueWhenDeleted )

inline

Creates a ScopedValueSetter that will immediately change the specified value to the given new value, and will then reset it to be valueWhenDeleted when this object is deleted.

## ~ScopedValueSetter()

template<typename ValueType>

juce::ScopedValueSetter< ValueType >::~ScopedValueSetter | ( |  | ) |

inline

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited