diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-11-29 13:32:04 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-11-29 13:32:04 +0000 |
commit | 03fc6a84cd47911dfcc873669a69da6cbcc308d1 (patch) | |
tree | 650bf49d8971dbf6bafa9dd0488b8305a5579092 /util | |
parent | 991917c6cbd9969fcb3741d24d0fa0d2e0cfaba0 (diff) | |
parent | 56a560baa86b52c66ce622414579975930421950 (diff) | |
download | ydb-03fc6a84cd47911dfcc873669a69da6cbcc308d1.tar.gz |
Merge branch 'rightlib' into mergelibs-241129-1330
Diffstat (limited to 'util')
-rw-r--r-- | util/generic/array_ref.h | 4 | ||||
-rw-r--r-- | util/generic/scope.h | 9 |
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 };` // |