aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/scope.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/generic/scope.h
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/scope.h')
-rw-r--r--util/generic/scope.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/util/generic/scope.h b/util/generic/scope.h
index e03d86bcde..b2c33af61e 100644
--- a/util/generic/scope.h
+++ b/util/generic/scope.h
@@ -10,14 +10,14 @@ namespace NPrivate {
class TScopeGuard {
public:
TScopeGuard(const F& function)
- : Function_{function}
- {
- }
+ : Function_{function}
+ {
+ }
TScopeGuard(F&& function)
- : Function_{std::move(function)}
- {
- }
+ : Function_{std::move(function)}
+ {
+ }
TScopeGuard(TScopeGuard&&) = default;
TScopeGuard(const TScopeGuard&) = default;
@@ -26,17 +26,17 @@ namespace NPrivate {
Function_();
}
- private:
- F Function_;
- };
-
+ private:
+ F Function_;
+ };
+
struct TMakeGuardHelper {
template <class F>
- TScopeGuard<F> operator|(F&& function) const {
+ TScopeGuard<F> operator|(F&& function) const {
return std::forward<F>(function);
}
- };
-}
+ };
+}
// \brief `Y_SCOPE_EXIT(captures) { body };`
//
@@ -46,7 +46,7 @@ namespace NPrivate {
// @note expects `body` to provide no-throw guarantee, otherwise whenever an exception
// is thrown and leaves the outermost block of `body`, the function `std::terminate` is called.
// @see http://drdobbs.com/184403758 for detailed motivation.
-#define Y_SCOPE_EXIT(...) const auto Y_GENERATE_UNIQUE_ID(scopeGuard) Y_DECLARE_UNUSED = ::NPrivate::TMakeGuardHelper{} | [__VA_ARGS__]() mutable -> void
+#define Y_SCOPE_EXIT(...) const auto Y_GENERATE_UNIQUE_ID(scopeGuard) Y_DECLARE_UNUSED = ::NPrivate::TMakeGuardHelper{} | [__VA_ARGS__]() mutable -> void
// \brief `Y_DEFER { body };`
//
@@ -62,4 +62,4 @@ namespace NPrivate {
// ... try handle `item` ...
// ok = true;
// \endcode
-#define Y_DEFER Y_SCOPE_EXIT(&)
+#define Y_DEFER Y_SCOPE_EXIT(&)