c++ non-type parameter pack expansion
问题 I am writing template function that is parametrized by single type, and has variable number of parameters of the same type (not of different types). It should check if first value is among the rest. I wanted to write it like this: #include <unordered_set> template <typename T> static bool value_in(T val, T vals...) { // compiles, but uses only vals[0]: const std::unordered_set<T> allowed {vals}; // error: pack expansion does not contain any unexpanded parameter packs: // const std::unordered