avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
av::ScopedValue< T, V > Class Template Reference

Functor to take next element in list/array. More...

#include <avutils.h>

Public Member Functions

 ScopedValue (T &var, const V &outValue)
 Ctor.
 ScopedValue (T &var, const V &inValue, const V &outValue)
 Ctor.

Detailed Description

template<typename T, typename V = T>
class av::ScopedValue< T, V >

Teamplate class to set value for variable when out of scope will be occured. Use RAII idiom.

By default type of variable and value is same, but it can be simple overriden, use

ScopedValue<VariableType, OutValueType> scopedValue(variable, false);
ScopedValue(T &var, const V &outValue)
Ctor.
Definition avutils.h:411

instead

ScopedValue<VariableType> scopedValue(variable, false);

Constructor & Destructor Documentation

◆ ScopedValue() [1/2]

template<typename T, typename V = T>
av::ScopedValue< T, V >::ScopedValue ( T & var,
const V & outValue )
inline

Store reference to variable and output value.

Parameters
varvariable that must be set
outValuevalue of variable

◆ ScopedValue() [2/2]

template<typename T, typename V = T>
av::ScopedValue< T, V >::ScopedValue ( T & var,
const V & inValue,
const V & outValue )
inline

Like previous one but automaticaly can assign initial value to variable.

Parameters
varvariable that must be set
inValueinitial value
outValueoutput value

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