FastLED 3.10.8
Loading...
Searching...
No Matches
scope_exit.h
Go to the documentation of this file.
1#pragma once
2
8
10#include "fl/stl/noexcept.h"
11
12namespace fl {
13
16template <typename EF>
18public:
19 template <typename EFP>
20 explicit scope_exit(EFP &&f)
21 : mExitFunction(fl::forward<EFP>(f)), mActive(true) {}
22
24 : mExitFunction(fl::move(rhs.mExitFunction)), mActive(rhs.mActive) {
25 rhs.release();
26 }
27
31
33 if (mActive) {
35 }
36 }
37
38 void release() FL_NO_EXCEPT { mActive = false; }
39
40private:
42 bool mActive;
43};
44
47template <typename EF>
51
52} // namespace fl
void release() FL_NO_EXCEPT
Definition scope_exit.h:38
scope_exit & operator=(scope_exit &&) FL_NO_EXCEPT=delete
scope_exit & operator=(const scope_exit &) FL_NO_EXCEPT=delete
scope_exit(const scope_exit &) FL_NO_EXCEPT=delete
scope_exit(scope_exit &&rhs) FL_NO_EXCEPT
Definition scope_exit.h:23
scope_exit(EFP &&f)
Definition scope_exit.h:20
RAII guard that executes a callable when destroyed.
Definition scope_exit.h:17
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition move.h:30
constexpr T && forward(typename remove_reference< T >::type &t) FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
scope_exit< decay_t< EF > > make_scope_exit(EF &&f)
Factory for C++11/14 (no CTAD).
Definition scope_exit.h:48
Base definition for an LED controller.
Definition crgb.hpp:179