Skip to content

Commit 79d3849

Browse files
committed
add github workflow for test-pypi cross-OS wheel builds
1 parent 25654c3 commit 79d3849

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

  • include/fdaPDE-cpp/fdaPDE/core/fdaPDE/src/utility

include/fdaPDE-cpp/fdaPDE/core/fdaPDE/src/utility/meta.h

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,27 @@ namespace fdapde {
2323
namespace internals {
2424

2525
// apply lambda F_ to each value in index pack {0, ..., N_ - 1}
26-
template <typename F_, int... Ns_>
27-
constexpr decltype(auto) apply_index_pack_impl(F_&& f, std::integer_sequence<int, Ns_...>) {
28-
return f.template operator()<Ns_...>();
29-
}
30-
template <int N_, typename F_> constexpr decltype(auto) apply_index_pack(F_&& f) {
31-
return internals::apply_index_pack_impl(std::forward<F_>(f), std::make_integer_sequence<int, N_>{});
32-
}
26+
template <int... Ns>
27+
struct index_tag {};
28+
29+
// 2. The implementation now takes the tag as an argument
30+
template <typename F_, int... Ns_>
31+
constexpr decltype(auto) apply_impl(F_&& f, index_tag<Ns_...>) {
32+
// We pass the integers as types via the tag, not as template args to the call
33+
return std::forward<F_>(f).template operator()<Ns_...>();
34+
}
3335

36+
// 3. A helper to convert integer_sequence to our tag
37+
template <typename F_, int... Ns_>
38+
constexpr decltype(auto) sequence_to_tag(F_&& f, std::integer_sequence<int, Ns_...>) {
39+
return apply_impl(std::forward<F_>(f), index_tag<Ns_...>{});
40+
}
41+
42+
template <int N_, typename F_>
43+
constexpr decltype(auto) apply_index_pack(F_&& f) {
44+
return internals::sequence_to_tag(std::forward<F_>(f), std::make_integer_sequence<int, N_>{});
45+
}
46+
3447
template <int N_, typename F_> constexpr void for_each_index_in_pack(F_&& f) {
3548
[&]<int... Ns_>(std::integer_sequence<int, Ns_...>) {
3649
(f.template operator()<Ns_>(), ...);

0 commit comments

Comments
 (0)