I tried to do function that checks if the argument matches specific values.
I think know how to do it with recursion or std::initializer_list, but I want to do it with fold. Here is non working code:
template<typename T, T ...ts>
constexpr bool is_in(T value){
return (ts == value) || ... || (false);
}
int main(){
if constexpr(is_in<int, 1, 2, 3>(1))
return 10;
}
Also I would like to get rid of specifying the type if possible (e.g. the )
Want solution in C++17, but C++20 would be interesting to see as well.