Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
scope_exit.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-2.0-or-later
6
#ifndef INKSCAPE_UTIL_SCOPE_EXIT_H
7
#define INKSCAPE_UTIL_SCOPE_EXIT_H
8
9
#include <type_traits>
10
#include <utility>
11
12
// Todo: (C++23?) Replace with now-standardised version.
13
template
<
typename
F>
14
class
scope_exit
15
{
16
public
:
17
scope_exit
(F &&
f
) :
f
(
std
::forward<F>(
f
)) {}
18
scope_exit
(
scope_exit
const
&) =
delete
;
19
scope_exit
&
operator=
(
scope_exit
const
&) =
delete
;
20
~scope_exit
() {
f
(); }
21
22
private
:
23
std::decay_t<F>
f
;
24
};
25
26
#endif
// INKSCAPE_UTIL_SCOPE_EXIT_H
scope_exit
Definition
scope_exit.h:15
scope_exit::f
std::decay_t< F > f
Definition
scope_exit.h:23
scope_exit::~scope_exit
~scope_exit()
Definition
scope_exit.h:20
scope_exit::scope_exit
scope_exit(F &&f)
Definition
scope_exit.h:17
scope_exit::operator=
scope_exit & operator=(scope_exit const &)=delete
scope_exit::scope_exit
scope_exit(scope_exit const &)=delete
std
STL namespace.
src
util
scope_exit.h
Generated on Sun Jul 13 2025 04:02:23 for Inkscape by
1.9.8