JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
List of all members
juce::ScopeGuard< Fn > Struct Template Reference

An easy way to ensure that a function is called at the end of the current scope. More...

#include "juce_ScopeGuard.h"

Inheritance diagram for juce::ScopeGuard< Fn >:
Fn

Detailed Description

template<typename Fn>
struct juce::ScopeGuard< Fn >

An easy way to ensure that a function is called at the end of the current scope.

Usage:

{
if (flag == true)
return;
// While this code executes, flag is true e.g. to prevent reentrancy
flag = true;
// When we exit this scope, flag must be false
const ScopeGuard scope { [&] { flag = false; } };
return; // Scope's lambda will fire here...
throw std::runtime_error{}; // ...or here...
} // ...or here!
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
An easy way to ensure that a function is called at the end of the current scope.

@tags{Core}

Definition at line 52 of file juce_ScopeGuard.h.

Constructor & Destructor Documentation

◆ ~ScopeGuard()

template<typename Fn >
juce::ScopeGuard< Fn >::~ScopeGuard ( )

Definition at line 52 of file juce_ScopeGuard.h.


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