aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/scope.h
diff options
context:
space:
mode:
authorsharpeye <sharpeye@yandex-team.ru>2022-02-10 16:49:16 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:16 +0300
commit9a407601824f50398148409237b90de3f95b5ae3 (patch)
treeb5245ea2b5ed12d65fe1230d5f6dae0b9b129894 /util/generic/scope.h
parent1c61afbf3db63940d05e6fefa3104b03457788a1 (diff)
downloadydb-9a407601824f50398148409237b90de3f95b5ae3.tar.gz
Restoring authorship annotation for <sharpeye@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/scope.h')
-rw-r--r--util/generic/scope.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/util/generic/scope.h b/util/generic/scope.h
index b2c33af61e7..0d7a3b13d3e 100644
--- a/util/generic/scope.h
+++ b/util/generic/scope.h
@@ -1,43 +1,43 @@
#pragma once
-#include <util/system/compiler.h>
+#include <util/system/compiler.h>
#include <util/system/defaults.h>
+
+#include <utility>
-#include <utility>
-
-namespace NPrivate {
- template <typename F>
- class TScopeGuard {
- public:
- TScopeGuard(const F& function)
+namespace NPrivate {
+ template <typename F>
+ class TScopeGuard {
+ public:
+ TScopeGuard(const F& function)
: Function_{function}
{
}
- TScopeGuard(F&& function)
+ TScopeGuard(F&& function)
: Function_{std::move(function)}
{
}
- TScopeGuard(TScopeGuard&&) = default;
- TScopeGuard(const TScopeGuard&) = default;
-
- ~TScopeGuard() {
- Function_();
- }
-
+ TScopeGuard(TScopeGuard&&) = default;
+ TScopeGuard(const TScopeGuard&) = default;
+
+ ~TScopeGuard() {
+ Function_();
+ }
+
private:
F Function_;
};
- struct TMakeGuardHelper {
- template <class F>
+ struct TMakeGuardHelper {
+ template <class F>
TScopeGuard<F> operator|(F&& function) const {
- return std::forward<F>(function);
- }
+ return std::forward<F>(function);
+ }
};
}
-
+
// \brief `Y_SCOPE_EXIT(captures) { body };`
//
// General implementaion of RAII idiom (resource acquisition is initialization). Executes