Checking for duplicate types in a list of types

时间:2017-04-13 14:55:18

标签: c++ c++14 template-meta-programming

Is it possible to check if the variadic list contains no duplicate types in c++ 14?

template <class... Ts>
bool is_unique() {
    ...
}

static_assert(is_unique<a, b, c>() == true,  ""); //true: No duplicates 
static_assert(is_unique<a, b, a>() == false, ""); //false: contains 2 a's

0 个答案:

没有答案