This is a code snippet that I am going to use in order to check whether the variadic template types are unique:
template
struct is_one_of
I'm in line with Brian Rodriguez's and Piotr Scontnincki's answers, as far as it concerns the fold expressions part. Until folding expressions are in, you could shrink the existing code a little bit by getting rid of the incomplete primary templates as follows:
template
struct is_one_of {
static constexpr bool value = false;
};
template
struct is_one_of {
static constexpr bool value =
std::is_same::value || is_one_of::value;
};
template
struct is_unique {
static constexpr bool value = true;
};
template
struct is_unique {
static constexpr bool value = is_unique::value && !is_one_of::value;
};