diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /util/generic/scope.h | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/scope.h')
-rw-r--r-- | util/generic/scope.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/util/generic/scope.h b/util/generic/scope.h index b2c33af61e..a54ffc2644 100644 --- a/util/generic/scope.h +++ b/util/generic/scope.h @@ -38,28 +38,28 @@ namespace NPrivate { }; } -// \brief `Y_SCOPE_EXIT(captures) { body };` -// -// General implementaion of RAII idiom (resource acquisition is initialization). Executes -// function upon return from the current scope. -// +// \brief `Y_SCOPE_EXIT(captures) { body };` +// +// General implementaion of RAII idiom (resource acquisition is initialization). Executes +// function upon return from the current scope. +// // @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. +// @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 - -// \brief `Y_DEFER { body };` -// -// Same as `Y_SCOPE_EXIT` but doesn't require user to provide capture-list explicitly (it + +// \brief `Y_DEFER { body };` +// +// Same as `Y_SCOPE_EXIT` but doesn't require user to provide capture-list explicitly (it // implicitly uses `[&]` capture). Have same requirements for `body`. -// -// Inspired by `defer` statement in languages like Swift and Go. -// -// \code -// auto item = s.pop(); -// bool ok = false; -// Y_DEFER { if (!ok) { s.push(std::move(item)); } }; -// ... try handle `item` ... -// ok = true; -// \endcode +// +// Inspired by `defer` statement in languages like Swift and Go. +// +// \code +// auto item = s.pop(); +// bool ok = false; +// Y_DEFER { if (!ok) { s.push(std::move(item)); } }; +// ... try handle `item` ... +// ok = true; +// \endcode #define Y_DEFER Y_SCOPE_EXIT(&) |