diff options
author | arkady-e1ppa <arkady-e1ppa@yandex-team.com> | 2023-11-21 20:00:15 +0300 |
---|---|---|
committer | arkady-e1ppa <arkady-e1ppa@yandex-team.com> | 2023-11-21 21:30:38 +0300 |
commit | 3bd0548b8ad22a8db865e6816673817c9d911cf4 (patch) | |
tree | 0c42a67785a97a3b139e1ed62197d41de68e7dd8 | |
parent | 2abd86e5424beaff8e7043e8f49d844be2e242b3 (diff) | |
download | ydb-3bd0548b8ad22a8db865e6816673817c9d911cf4.tar.gz |
Address issues of rXXXXXX
Some new overloads to better support allocationId as strongly typed entity
-rw-r--r-- | library/cpp/yt/misc/strong_typedef-inl.h | 10 | ||||
-rw-r--r-- | library/cpp/yt/misc/strong_typedef.h | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/library/cpp/yt/misc/strong_typedef-inl.h b/library/cpp/yt/misc/strong_typedef-inl.h index 59ff7cbce2..43bdabf583 100644 --- a/library/cpp/yt/misc/strong_typedef-inl.h +++ b/library/cpp/yt/misc/strong_typedef-inl.h @@ -62,7 +62,7 @@ constexpr T&& TStrongTypedef<T, TTag>::Underlying() && template <class T, class TTag> constexpr bool TStrongTypedef<T, TTag>::operator==(const TStrongTypedef& rhs) const -noexcept(std::same_as<T, void> || noexcept(Underlying_ == rhs.Underlying_)) + noexcept(std::same_as<T, void> || noexcept(Underlying_ == rhs.Underlying_)) { //! NB: We add a constexpr branch to keep constexprness of the function //! without making extra specializations explicitly. @@ -75,7 +75,7 @@ noexcept(std::same_as<T, void> || noexcept(Underlying_ == rhs.Underlying_)) template <class T, class TTag> constexpr auto TStrongTypedef<T, TTag>::operator<=>(const TStrongTypedef& rhs) const -noexcept(std::same_as<T, void> || noexcept(Underlying_ <=> rhs.Underlying_)) + noexcept(std::same_as<T, void> || noexcept(Underlying_ <=> rhs.Underlying_)) { //! NB: We add a constexpr branch to keep constexprness of the function //! without making extra specializations explicitly. @@ -148,11 +148,11 @@ struct THash<NYT::TStrongTypedef<T, TTag>> { size_t operator()(const NYT::TStrongTypedef<T, TTag>& value) const { - static constexpr bool IsTHashable = requires (T val) { - { THash<T>()(val) } -> std::same_as<size_t>; + static constexpr bool IsHashable = requires (T value) { + { THash<T>()(value) } -> std::same_as<size_t>; }; - if constexpr (IsTHashable) { + if constexpr (IsHashable) { return THash<T>()(value.Underlying()); } else { return std::hash<T>()(value.Underlying()); diff --git a/library/cpp/yt/misc/strong_typedef.h b/library/cpp/yt/misc/strong_typedef.h index d42f9e1f74..dfb479a8c6 100644 --- a/library/cpp/yt/misc/strong_typedef.h +++ b/library/cpp/yt/misc/strong_typedef.h @@ -31,10 +31,10 @@ public: constexpr explicit operator T&(); constexpr bool operator==(const TStrongTypedef& rhs) const - noexcept(std::same_as<T, void> || noexcept(Underlying_ == rhs.Underlying_)); + noexcept(std::same_as<T, void> || noexcept(Underlying_ == rhs.Underlying_)); constexpr auto operator<=>(const TStrongTypedef& rhs) const - noexcept(std::same_as<T, void> || noexcept(Underlying_ <=> rhs.Underlying_)); + noexcept(std::same_as<T, void> || noexcept(Underlying_ <=> rhs.Underlying_)); constexpr T& Underlying() &; constexpr const T& Underlying() const &; |