aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/algorithm.h
diff options
context:
space:
mode:
authorbulatman <bulatman@yandex-team.ru>2022-02-10 16:45:50 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:50 +0300
commit2f6ca198245aeffd5e2d82b65927c2465b68b4f5 (patch)
tree9142afc54d335ea52910662635b898e79e192e49 /util/generic/algorithm.h
parent6560e4993b14d193f8c879e33a3de5e5eba6e21d (diff)
downloadydb-2f6ca198245aeffd5e2d82b65927c2465b68b4f5.tar.gz
Restoring authorship annotation for <bulatman@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/algorithm.h')
-rw-r--r--util/generic/algorithm.h88
1 files changed, 44 insertions, 44 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h
index 0561a5cc15..badfb88993 100644
--- a/util/generic/algorithm.h
+++ b/util/generic/algorithm.h
@@ -562,61 +562,61 @@ inline void ForEach(TI f, TI l, TOp op) {
namespace NPrivate {
template <class T, class TOp, size_t... Is>
- constexpr bool AllOfImpl(T&& t, TOp&& op, std::index_sequence<Is...>) {
-#if _LIBCPP_STD_VER >= 17
- return (true && ... && op(std::get<Is>(std::forward<T>(t))));
-#else
- bool result = true;
- auto wrapper = [&result, &op](auto&& x) { result = result && op(std::forward<decltype(x)>(x)); };
- int dummy[] = {(wrapper(std::get<Is>(std::forward<T>(t))), 0)...};
- Y_UNUSED(dummy);
- return result;
-#endif
- }
-
- template <class T, class TOp, size_t... Is>
- constexpr bool AnyOfImpl(T&& t, TOp&& op, std::index_sequence<Is...>) {
-#if _LIBCPP_STD_VER >= 17
- return (false || ... || op(std::get<Is>(std::forward<T>(t))));
-#else
- bool result = false;
- auto wrapper = [&result, &op](auto&& x) { result = result || op(std::forward<decltype(x)>(x)); };
- int dummy[] = {(wrapper(std::get<Is>(std::forward<T>(t))), 0)...};
- Y_UNUSED(dummy);
- return result;
-#endif
- }
-
- template <class T, class TOp, size_t... Is>
- constexpr void ForEachImpl(T&& t, TOp&& op, std::index_sequence<Is...>) {
-#if _LIBCPP_STD_VER >= 17
- (..., op(std::get<Is>(std::forward<T>(t))));
-#else
+ constexpr bool AllOfImpl(T&& t, TOp&& op, std::index_sequence<Is...>) {
+#if _LIBCPP_STD_VER >= 17
+ return (true && ... && op(std::get<Is>(std::forward<T>(t))));
+#else
+ bool result = true;
+ auto wrapper = [&result, &op](auto&& x) { result = result && op(std::forward<decltype(x)>(x)); };
+ int dummy[] = {(wrapper(std::get<Is>(std::forward<T>(t))), 0)...};
+ Y_UNUSED(dummy);
+ return result;
+#endif
+ }
+
+ template <class T, class TOp, size_t... Is>
+ constexpr bool AnyOfImpl(T&& t, TOp&& op, std::index_sequence<Is...>) {
+#if _LIBCPP_STD_VER >= 17
+ return (false || ... || op(std::get<Is>(std::forward<T>(t))));
+#else
+ bool result = false;
+ auto wrapper = [&result, &op](auto&& x) { result = result || op(std::forward<decltype(x)>(x)); };
+ int dummy[] = {(wrapper(std::get<Is>(std::forward<T>(t))), 0)...};
+ Y_UNUSED(dummy);
+ return result;
+#endif
+ }
+
+ template <class T, class TOp, size_t... Is>
+ constexpr void ForEachImpl(T&& t, TOp&& op, std::index_sequence<Is...>) {
+#if _LIBCPP_STD_VER >= 17
+ (..., op(std::get<Is>(std::forward<T>(t))));
+#else
::ApplyToMany(std::forward<TOp>(op), std::get<Is>(std::forward<T>(t))...);
-#endif
+#endif
}
}
-// check that TOp return true for all of element from tuple T
+// check that TOp return true for all of element from tuple T
template <class T, class TOp>
-constexpr ::TEnableIfTuple<T, bool> AllOf(T&& t, TOp&& op) {
- return ::NPrivate::AllOfImpl(
+constexpr ::TEnableIfTuple<T, bool> AllOf(T&& t, TOp&& op) {
+ return ::NPrivate::AllOfImpl(
std::forward<T>(t),
std::forward<TOp>(op),
std::make_index_sequence<std::tuple_size<std::decay_t<T>>::value>{});
-}
-
-// check that TOp return true for at least one element from tuple T
-template <class T, class TOp>
-constexpr ::TEnableIfTuple<T, bool> AnyOf(T&& t, TOp&& op) {
- return ::NPrivate::AnyOfImpl(
+}
+
+// check that TOp return true for at least one element from tuple T
+template <class T, class TOp>
+constexpr ::TEnableIfTuple<T, bool> AnyOf(T&& t, TOp&& op) {
+ return ::NPrivate::AnyOfImpl(
std::forward<T>(t),
std::forward<TOp>(op),
std::make_index_sequence<std::tuple_size<std::decay_t<T>>::value>{});
-}
-
-template <class T, class TOp>
-constexpr ::TEnableIfTuple<T> ForEach(T&& t, TOp&& op) {
+}
+
+template <class T, class TOp>
+constexpr ::TEnableIfTuple<T> ForEach(T&& t, TOp&& op) {
::NPrivate::ForEachImpl(
std::forward<T>(t),
std::forward<TOp>(op),