Checking that a template type T is part of a variadic parameter pack in C++17

Viewed 136

I want to check that a type T is also part of a parameter pack Ts. There are solutions that do that in C++14, but I'm wandering if this can be simplified in C++17. If T is not found in Tsthe compiler should stop (static_assertion should fail).

template<typename... Ts>
class A
{
  template<typename T>
  void action() {
    // check that T is also in Ts (static_assertion)
  }
}
3 Answers
Related