To limit a template parameter pack to a certain type, this can be done in the following way:
std::enable_if_t<std::conjunction_v<std::is_same<int32_t, Ts>...>>
send(bool condition, Ts...);
I would actually allow int32_t and std::string and any order.
How can this be expressed?
I had a workaround using a variant, but this does not look so nice to me:
using allowed_types = std::variant<int32_t, std::string>;
template<typename... Ts>
std::enable_if_t<std::conjunction_v<std::is_assignable<allowed_types, Ts>...>>
send(bool condition, Ts...);
And this does not compile:
std::enable_if_t<std::conjunction_v<std::is_same<int32_t, Ts> || std::is_same<std::string, Ts>...>> // <- does not compile!
send(bool condition, Ts...);