diff --git a/include/stdx/concepts.hpp b/include/stdx/concepts.hpp index 1e1eb23..f8c74e5 100644 --- a/include/stdx/concepts.hpp +++ b/include/stdx/concepts.hpp @@ -156,7 +156,6 @@ template concept is_vacuous_tuple = tuple_size_v> == 0; constexpr inline auto concept_try_get = [](auto &x) -> decltype(auto) { - using std::get; return get<0>(x); }; diff --git a/include/stdx/tuple.hpp b/include/stdx/tuple.hpp index adfacb9..dbb76c2 100644 --- a/include/stdx/tuple.hpp +++ b/include/stdx/tuple.hpp @@ -418,6 +418,18 @@ struct tuple_impl, index_function_list, Ts...> template tuple_impl(Ts...) -> tuple_impl, index_function_list<>, Ts...>; + +template +[[nodiscard]] constexpr auto get(Tuple &&t LIFETIMEBOUND) + -> decltype(std::forward(t)[index]) { + return std::forward(t)[index]; +} + +template +[[nodiscard]] constexpr auto get(Tuple &&t LIFETIMEBOUND) + -> decltype(std::forward(t).get(tag)) { + return std::forward(t).get(tag); +} } // namespace detail template struct tuple_element { @@ -456,17 +468,7 @@ class indexed_tuple : public detail::tuple_impl, template indexed_tuple(Ts...) -> indexed_tuple, Ts...>; -template -[[nodiscard]] constexpr auto get(Tuple &&t LIFETIMEBOUND) - -> decltype(std::forward(t)[index]) { - return std::forward(t)[index]; -} - -template -[[nodiscard]] constexpr auto get(Tuple &&t LIFETIMEBOUND) - -> decltype(std::forward(t).get(tag)) { - return std::forward(t).get(tag); -} +using detail::get; template [[nodiscard]] constexpr auto make_tuple(Ts &&...ts) { return tuple...>{std::forward(ts)...}; diff --git a/include/stdx/tuple_algorithms.hpp b/include/stdx/tuple_algorithms.hpp index 74d8fa0..be86d1f 100644 --- a/include/stdx/tuple_algorithms.hpp +++ b/include/stdx/tuple_algorithms.hpp @@ -121,19 +121,19 @@ template }(std::make_index_sequence>{}); } -template +template [[nodiscard]] constexpr auto tuple_push_front(T &&t, Tup &&tup) -> decltype(auto) { return tuple_cons(std::forward(t), std::forward(tup)); } -template +template [[nodiscard]] constexpr auto tuple_push_back(Tup &&tup, T &&t) -> decltype(auto) { return tuple_snoc(std::forward(tup), std::forward(t)); } -template