Skip to content

Commit fd3a42b

Browse files
committed
Refactor get function signatures in tuple.h for improved type deduction
- Updated all overloads of the `get` function in `tuple.h` to return `auto&&` instead of `decltype(auto)` for better type inference. - Enhanced consistency across function signatures by applying the same return type pattern. - Minor formatting adjustments for improved readability and maintainability.
1 parent 054b608 commit fd3a42b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

include/fast_io_dsal/impl/tuple.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,23 @@ tuple(Args &&...) -> tuple<Args...>;
9696
template <::std::size_t I, typename... Args>
9797
FAST_IO_GNU_ALWAYS_INLINE
9898
[[nodiscard]]
99-
constexpr decltype(auto) get(::fast_io::containers::tuple<Args...> &self) noexcept
99+
constexpr auto&& get(::fast_io::containers::tuple<Args...> &self) noexcept
100100
{
101101
return static_cast<::fast_io::containers::details::tuple_element_impl_<I, ::fast_io::containers::details::pack_indexing_t_<I, Args...>> &>(self).val_;
102102
}
103103

104104
template <::std::size_t I, typename... Args>
105105
FAST_IO_GNU_ALWAYS_INLINE
106106
[[nodiscard]]
107-
constexpr decltype(auto) get(::fast_io::containers::tuple<Args...> const &self) noexcept
107+
constexpr auto&& get(::fast_io::containers::tuple<Args...> const &self) noexcept
108108
{
109109
return static_cast<::fast_io::containers::details::tuple_element_impl_<I, ::fast_io::containers::details::pack_indexing_t_<I, Args...>> const &>(self).val_;
110110
}
111111

112112
template <::std::size_t I, typename... Args>
113113
FAST_IO_GNU_ALWAYS_INLINE
114114
[[nodiscard]]
115-
constexpr decltype(auto) get(::fast_io::containers::tuple<Args...> &&self) noexcept
115+
constexpr auto&& get(::fast_io::containers::tuple<Args...> &&self) noexcept
116116
{
117117
return ::std::move(
118118
static_cast<::fast_io::containers::details::tuple_element_impl_<I, ::fast_io::containers::details::pack_indexing_t_<I, Args...>> &&>(self).val_);
@@ -121,7 +121,7 @@ FAST_IO_GNU_ALWAYS_INLINE
121121
template <::std::size_t I, typename... Args>
122122
FAST_IO_GNU_ALWAYS_INLINE
123123
[[nodiscard]]
124-
constexpr decltype(auto) get(::fast_io::containers::tuple<Args...> const &&self) noexcept
124+
constexpr auto&& get(::fast_io::containers::tuple<Args...> const &&self) noexcept
125125
{
126126
return ::std::move(
127127
static_cast<::fast_io::containers::details::tuple_element_impl_<I, ::fast_io::containers::details::pack_indexing_t_<I, Args...>> const &&>(self).val_);
@@ -149,7 +149,7 @@ template <typename T, typename... Args>
149149
requires((::std::same_as<T, Args> + ...) == 1)
150150
FAST_IO_GNU_ALWAYS_INLINE
151151
[[nodiscard]]
152-
constexpr decltype(auto) get(::fast_io::containers::tuple<Args...> const &self) noexcept
152+
constexpr auto&& get(::fast_io::containers::tuple<Args...> const &self) noexcept
153153
{
154154
return static_cast<decltype(::fast_io::containers::details::get_tuple_element_by_type_<T, 0, Args...>())::type const &>(self).val_;
155155
}
@@ -158,7 +158,7 @@ template <typename T, typename... Args>
158158
requires((::std::same_as<T, Args> + ...) == 1)
159159
FAST_IO_GNU_ALWAYS_INLINE
160160
[[nodiscard]]
161-
constexpr decltype(auto) get(::fast_io::containers::tuple<Args...> const &&self) noexcept
161+
constexpr auto&& get(::fast_io::containers::tuple<Args...> const &&self) noexcept
162162
{
163163
return ::std::move(
164164
static_cast<decltype(::fast_io::containers::details::get_tuple_element_by_type_<T, 0, Args...>())::type const &&>(self).val_);
@@ -168,7 +168,7 @@ template <typename T, typename... Args>
168168
requires((::std::same_as<T, Args> + ...) == 1)
169169
FAST_IO_GNU_ALWAYS_INLINE
170170
[[nodiscard]]
171-
constexpr decltype(auto) get(::fast_io::containers::tuple<Args...> &self) noexcept
171+
constexpr auto&& get(::fast_io::containers::tuple<Args...> &self) noexcept
172172
{
173173
return static_cast<decltype(::fast_io::containers::details::get_tuple_element_by_type_<T, 0, Args...>())::type const &>(self).val_;
174174
}
@@ -177,7 +177,7 @@ template <typename T, typename... Args>
177177
requires((::std::same_as<T, Args> + ...) == 1)
178178
FAST_IO_GNU_ALWAYS_INLINE
179179
[[nodiscard]]
180-
constexpr decltype(auto) get(::fast_io::containers::tuple<Args...> &&self) noexcept
180+
constexpr auto&& get(::fast_io::containers::tuple<Args...> &&self) noexcept
181181
{
182182
return ::std::move(
183183
static_cast<decltype(::fast_io::containers::details::get_tuple_element_by_type_<T, 0, Args...>())::type const &&>(self).val_);

0 commit comments

Comments
 (0)