std::tuple a{1,3,4,5}
-> make it to numbers greater than 3
std::tuple b{4,5}
Or
std::tuple a{
std::integral_constant<int,1> {},
std::integral_constant<int,3> {},
std::integral_constant<int,4> {},
std::integral_constant<int,5> {}
}
to
std::tuple a{
std::integral_constant<int,4>{},
std::integral_constant<int,5>{}
};
How to convert this at compile time? I can do this using integer_sequence
but that is a cumbersome. Is there a simpler way in C++17 using fold expressions or std::apply
Also after filter, also need to get a tuple of unique entries. But my assumption is if filtering can be done, then finding unique would be trivial.
Edit so that is more clear:
std::tuple<int_c<1>, int_c<3>,int_c<4>,int_c<5>> to std::tuple<int_c<4>,int_c<5>
<-- If such is possible in a concise c++17 way without extra declare functions, it would do!.
Edit: I was fiddling around, maybe something like this would work:
with template... C
as the list of integrals constants:
constexpr auto result = std::tuple_cat(std::conditional_t<(C::value > 3), std::tuple<C>, std::tuple<>>{}...);
std::vector<int>
.template <std::size_t N>using int_c = std::integral_constant<int, N>; std::tuple<int_c<1>, int_c<3>,int_c<4>,int_c<5>>
tostd::tuple<int_c<4>,int_c<5>>
.