5namespace asyncpp::detail {
7 template<
size_t Index,
typename Arg0,
typename... Args>
8 static constexpr decltype(
auto) get_at_index_impl(Arg0&& first_arg, Args&&... args)
noexcept {
9 if constexpr (Index == 0) {
10 return std::forward<Arg0>(first_arg);
12 return get_at_index_impl<Index - 1>(std::forward<Args>(args)...);
17 parameter_pack() =
delete;
19 template<
size_t Index,
typename... Args>
20 static constexpr decltype(
auto) get_at_index(Args&&... args)
noexcept {
21 static_assert(Index <
sizeof...(Args),
"index out of range");
22 return get_at_index_impl<Index>(std::forward<Args>(args)...);
25 template<
typename... Args>
26 static constexpr decltype(
auto) get_last(Args&&... args)
noexcept {
27 static_assert(0 <
sizeof...(Args),
"parameter pack is empty");
28 return get_at_index_impl<
sizeof...(Args) - 1>(std::forward<Args>(args)...);