相关疑难解决方法(0)

无序的一对对,编译错误

我正在尝试创建一组无序的对

到目前为止,我有:

typedef std::pair<int, int> Move;
typedef std::unordered_set<Move> Set;
Run Code Online (Sandbox Code Playgroud)

我将在未来制作一套Move,现在我只有:

Set* King::possibleMoves() 
{
  Set hello;    <-------- THINK ERROR OCCURS HERE
  return &hello;
}
Run Code Online (Sandbox Code Playgroud)

但我一直得到这3个错误:

`/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:770:38: error: 
  implicit instantiation of undefined template 'std::__1::hash<std::__1::pair<int, int>
  >'
: public integral_constant<bool, __is_empty(_Tp)> {};
                                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:1951:40: note: 
  in instantiation of template class
  'std::__1::is_empty<std::__1::hash<std::__1::pair<int, int> > >' requested here
                            bool = is_empty<_T2>::value
                                   ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:1973:44: note: 
  in instantiation of default argument for '__libcpp_compressed_pair_switch<unsigned
  long, std::__1::hash<std::__1::pair<int, int> >, false, false>' required here
template <class _T1, class _T2, unsigned …
Run Code Online (Sandbox Code Playgroud)

c++

11
推荐指数
1
解决办法
5241
查看次数

标签 统计

c++ ×1