3#ifndef TETL_SCOPE_SCOPE_GUARD_HPP
4#define TETL_SCOPE_SCOPE_GUARD_HPP
6#include <etl/_type_traits/decay.hpp>
7#include <etl/_utility/forward.hpp>
8#include <etl/_utility/move.hpp>
10namespace etl::detail {
11template <
typename FuncT,
typename PolicyT>
15 explicit constexpr scope_guard(F&& f)
16 : _func{
etl::forward<F>(f)}
20 constexpr scope_guard(scope_guard&& rhs)
noexcept
21 : _func{
etl::move(rhs._func)}
22 , _policy{
etl::move(rhs._policy)}
26 constexpr ~scope_guard()
33 constexpr auto release()
noexcept ->
void
38 scope_guard(scope_guard
const&) =
delete;
39 auto operator=(scope_guard
const&) -> scope_guard& =
delete;
40 auto operator=(scope_guard&&) -> scope_guard& =
delete;
47struct scope_exit_impl {
48 constexpr scope_exit_impl() =
default;
50 constexpr scope_exit_impl(scope_exit_impl&& rhs)
noexcept
51 : should_execute{rhs.should_execute}
56 constexpr auto release()
noexcept ->
void
58 should_execute =
false;
61 explicit constexpr operator
bool()
const noexcept
63 return should_execute;
66 bool should_execute =
true;
Definition adjacent_find.hpp:9