【发布时间】:2014-02-02 20:25:41
【问题描述】:
是否可以通过 SFINAE 检查类型是否已完全定义?
例如
template <class T> struct hash;
template <> struct hash<int> {};
// is_defined_hash_type definition...
enum Enum { A, B, C, D };
static_assert ( is_defined_hash_type<int> ::value, "hash<int> should be defined");
static_assert (! is_defined_hash_type<Enum>::value, "hash<Enum> should not be defined");
解决方案不应修改 散列结构。
【问题讨论】:
标签: c++ c++11 metaprogramming sfinae