我希望有一个函数fn
,它将指针集指向const
和非const
对象。我正在写一个模板来做到这一点。nullptr_type不受simple_type_specifier支持
template<typename T1,
typename T2,
std::enable_if<std::is_same<T1,NodeType *>::value && std::is_same<T2,EdgeType *>::value, std::nullptr_t>::type = nullptr>
static void fn(unordered_set<T1> &nodeSet, unordered_set<T2>& edgeSet);
在上述例子中,我希望能够通过unordered_set<const NodeType *>
以及unordered_set<NodeType *>
(simliar与EdgeType
)。但是,我收到一个错误: ‘nullptr_type’ not supported by simple_type_specifier
。有人可以帮忙吗?
取代'的std :: nullptr_t> :: =类型nullptr'与',int> :: type = 0' – AndyG
我的确想到了这一点。但是,你能告诉我为什么''nullptr''不起作用吗? – SPMP
这个错误根本没有帮助,但是你只是缺少一个'typename'。 – 0x499602D2