If the list version should accept numbers, you can do this:
template<uint16_t ... Ports> struct port_in ....
I'm not sure there is a clean way to do this if it can take non-integer numbers and you need an actual list of types (these are not all arguments must be of the same type). If you can require all types to be the same, I think you could do something like:
template<typename T, std::enable_if_t<T> * = nullptr> struct port_in_base{}; template<typename T, T ... ports> struct port_in : port_in_base<T> ....
source share