diff options
author | bulatman <bulatman@yandex-team.com> | 2024-08-07 11:57:47 +0300 |
---|---|---|
committer | bulatman <bulatman@yandex-team.com> | 2024-08-07 13:31:02 +0300 |
commit | 933bb8d7a12d3881898904226e8884e8695275ef (patch) | |
tree | d8cab8f97af70f9212836898954ad0c1b82d9075 /util | |
parent | b40ff5999af2b70c1d06d37d4e9f7cebd80a8646 (diff) | |
download | ydb-933bb8d7a12d3881898904226e8884e8695275ef.tar.gz |
Make Apply just alias to std::apply
d8970078eca52675e02aa3cb811e07f99ef5115a
Diffstat (limited to 'util')
-rw-r--r-- | util/generic/function.h | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/util/generic/function.h b/util/generic/function.h index 859cc3f849..0ad42b40b6 100644 --- a/util/generic/function.h +++ b/util/generic/function.h @@ -100,19 +100,7 @@ using TFunctionArg = typename TFunctionArgImpl<C, N>::TResult; // temporary before std::apply appearance -template <typename F, typename Tuple, size_t... I> -auto ApplyImpl(F&& f, Tuple&& t, std::index_sequence<I...>) { - return f(std::get<I>(std::forward<Tuple>(t))...); -} - -// change to std::apply after c++ 17 template <typename F, typename Tuple> -auto Apply(F&& f, Tuple&& t) { - return ApplyImpl(f, t, std::make_index_sequence<std::tuple_size<std::decay_t<Tuple>>::value>{}); -} - -// change to std::apply after c++ 17 -template <typename F> -auto Apply(F&& f, std::tuple<>) { - return f(); +constexpr decltype(auto) Apply(F&& f, Tuple&& t) { + return std::apply(std::forward<F>(f), std::forward<Tuple>(t)); } |