aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-11-30 18:13:21 +0000
committerGitHub <noreply@github.com>2024-11-30 18:13:21 +0000
commit7466d62733bffe5cb040f37b21c5a9a4ad174353 (patch)
tree10d7bd92bb71816d77d6df3499415ad9575f92e7 /util
parentd7f99d9336ffa2fd5e9340c9b1d62fb767d70e9a (diff)
parent331f05c2e8cac3dc77c994803ae0721bf33b37a6 (diff)
downloadydb-7466d62733bffe5cb040f37b21c5a9a4ad174353.tar.gz
Merge pull request #12145 from ydb-platform/mergelibs-241129-1330
Library import 241129-1330
Diffstat (limited to 'util')
-rw-r--r--util/generic/array_ref.h4
-rw-r--r--util/generic/scope.h9
2 files changed, 4 insertions, 9 deletions
diff --git a/util/generic/array_ref.h b/util/generic/array_ref.h
index 2f8005449a..fb9ab0bcf1 100644
--- a/util/generic/array_ref.h
+++ b/util/generic/array_ref.h
@@ -77,7 +77,7 @@ public:
}
template <class TT, typename = std::enable_if_t<std::is_same<std::remove_const_t<T>, std::remove_const_t<TT>>::value>>
- bool operator==(const TArrayRef<TT>& other) const noexcept {
+ bool operator==(const TArrayRef<TT>& other) const {
return (S_ == other.size()) && std::equal(begin(), end(), other.begin());
}
@@ -130,6 +130,8 @@ public:
}
constexpr inline reference front() const noexcept {
+ Y_ASSERT(S_ > 0);
+
return *T_;
}
diff --git a/util/generic/scope.h b/util/generic/scope.h
index 0761e2962f..8c5a63090e 100644
--- a/util/generic/scope.h
+++ b/util/generic/scope.h
@@ -29,13 +29,6 @@ namespace NPrivate {
private:
F Function_;
};
-
- struct TMakeGuardHelper {
- template <class F>
- TScopeGuard<F> operator|(F&& function) const {
- return std::forward<F>(function);
- }
- };
} // namespace NPrivate
// \brief `Y_SCOPE_EXIT(captures) { body };`
@@ -46,7 +39,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 ::NPrivate::TScopeGuard Y_GENERATE_UNIQUE_ID(scopeGuard) Y_DECLARE_UNUSED = [__VA_ARGS__]() mutable -> void
// \brief `Y_DEFER { body };`
//