如何检查给定的类是否包含在参数包中

时间:2018-09-18 18:15:31

标签: c++ c++11 variadic-templates

给出:

class foo_t { };

template<class ... args_t> class bar_t
{
    static_assert(/*fire if foo_t is not part of args_t*/);
};

bar_t<foo_t, int, std::string> bar1; // ok
bar_t<char> bar2; // triggers static_assert above

如何实现有问题的static_assert?

0 个答案:

没有答案