如题,采用C++11/14/17均无法编译。
示例代码:
unordered_map<tuple<int,int,int>,bool>jl;
编译结果:
In file included from /usr/include/c++/8/unordered_map:46,
from /usr/include/c++/8/functional:61,
from /usr/include/x86_64-linux-gnu/c++/8/bits/stdc++.h:71,
from /tmp/compiler_4quo9a7y/src:1:
/usr/include/c++/8/bits/hashtable.h: In instantiation of ‘class std::_Hashtable<std::tuple<int, int, int>, std::pair<const std::tuple<int, int, int>, bool>, std::allocator<std::pair<const std::tuple<int, int, int>, bool> >, std::__detail::_Select1st, std::equal_to<std::tuple<int, int, int> >, std::hash<std::tuple<int, int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >’:
/usr/include/c++/8/bits/unordered_map.h:105:18: required from ‘class std::unordered_map<std::tuple<int, int, int>, bool>’
/tmp/compiler_4quo9a7y/src:11:39: required from here
/usr/include/c++/8/bits/hashtable.h:195:21: 错误:static assertion failed: hash function must be invocable with an argument of key type
static_assert(__is_invocable<const _H1&, const _Key&>{},
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/compiler_4quo9a7y/src:11:39: 错误:使用了被删除的函数‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::tuple<int, int, int>; _Tp = bool; _Hash = std::hash<std::tuple<int, int, int> >; _Pred = std::equal_to<std::tuple<int, int, int> >; _Alloc = std::allocator<std::pair<const std::tuple<int, int, int>, bool> >]’
unordered_map<tuple<int,int,int>,bool>jl;
^~
In file included from /usr/include/c++/8/unordered_map:47,
from /usr/include/c++/8/functional:61,
from /usr/include/x86_64-linux-gnu/c++/8/bits/stdc++.h:71,
from /tmp/compiler_4quo9a7y/src:1:
/usr/include/c++/8/bits/unordered_map.h:141:7: 附注:‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::tuple<int, int, int>; _Tp = bool; _Hash = std::hash<std::tuple<int, int, int> >; _Pred = std::equal_to<std::tuple<int, int, int> >; _Alloc = std::allocator<std::pair<const std::tuple<int, int, int>, bool> >]’ is implicitly deleted because the default definition would be ill-formed:
unordered_map() = default;
^~~~~~~~~~~~~
/usr/include/c++/8/bits/unordered_map.h:141:7: 错误:使用了被删除的函数‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::tuple<int, int, int>; _Value = std::pair<const std::tuple<int, int, int>, bool>; _Alloc = std::allocator<std::pair<const std::tuple<int, int, int>, bool> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::tuple<int, int, int> >; _H1 = std::hash<std::tuple<int, int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’
In file included from /usr/include/c++/8/unordered_map:46,
from /usr/include/c++/8/functional:61,
from /usr/include/x86_64-linux-gnu/c++/8/bits/stdc++.h:71,
from /tmp/compiler_4quo9a7y/src:1:
/usr/include/c++/8/bits/hashtable.h:413:7: 附注:‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::tuple<int, int, int>; _Value = std::pair<const std::tuple<int, int, int>, bool>; _Alloc = std::allocator<std::pair<const std::tuple<int, int, int>, bool> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::tuple<int, int, int> >; _H1 = std::hash<std::tuple<int, int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’ is implicitly deleted because the default definition would be ill-formed:
_Hashtable() = default;
^~~~~~~~~~
/usr/include/c++/8/bits/hashtable.h:413:7: 错误:使用了被删除的函数‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::_Hashtable_base() [with _Key = std::tuple<int, int, int>; _Value = std::pair<const std::tuple<int, int, int>, bool>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::tuple<int, int, int> >; _H1 = std::hash<std::tuple<int, int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’
In file included from /usr/include/c++/8/bits/hashtable.h:35,
from /usr/include/c++/8/unordered_map:46,
from /usr/include/c++/8/functional:61,
from /usr/include/x86_64-linux-gnu/c++/8/bits/stdc++.h:71,
from /tmp/compiler_4quo9a7y/src:1:
/usr/include/c++/8/bits/hashtable_policy.h:1824:5: 附注:‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::_Hashtable_base() [with _Key = std::tuple<int, int, int>; _Value = std::pair<const std::tuple<int, int, int>, bool>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::tuple<int, int, int> >; _H1 = std::hash<std::tuple<int, int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’ is implicitly deleted because the default definition would be ill-formed:
_Hashtable_base() = default;
^~~~~~~~~~~~~~~
/usr/include/c++/8/bits/hashtable_policy.h:1824:5: 错误:使用了被删除的函数‘std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::_Hash_code_base() [with _Key = std::tuple<int, int, int>; _Value = std::pair<const std::tuple<int, int, int>, bool>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::tuple<int, int, int> >; _H2 = std::__detail::_Mod_range_hashing]’
/usr/include/c++/8/bits/hashtable_policy.h:1379:7: 附注:‘std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::_Hash_code_base() [with _Key = std::tuple<int, int, int>; _Value = std::pair<const std::tuple<int, int, int>, bool>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::tuple<int, int, int> >; _H2 = std::__detail::_Mod_range_hashing]’ is implicitly deleted because the default definition would be ill-formed:
_Hash_code_base() = default;
^~~~~~~~~~~~~~~
/usr/include/c++/8/bits/hashtable_policy.h:1379:7: 错误:使用了被删除的函数‘std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::tuple<int, int, int> >]’
/usr/include/c++/8/bits/hashtable_policy.h:1106:7: 附注:‘std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::tuple<int, int, int> >]’ is implicitly deleted because the default definition would be ill-formed:
_Hashtable_ebo_helper() = default;
^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/8/bits/hashtable_policy.h:1106:7: 错误:使用了被删除的函数‘std::hash<std::tuple<int, int, int> >::hash()’
In file included from /usr/include/c++/8/string_view:43,
from /usr/include/c++/8/bits/basic_string.h:48,
from /usr/include/c++/8/string:52,
from /usr/include/c++/8/bits/locale_classes.h:40,
from /usr/include/c++/8/bits/ios_base.h:41,
from /usr/include/c++/8/ios:42,
from /usr/include/c++/8/istream:38,
from /usr/include/c++/8/sstream:38,
from /usr/include/c++/8/complex:45,
from /usr/include/c++/8/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/8/bits/stdc++.h:52,
from /tmp/compiler_4quo9a7y/src:1:
/usr/include/c++/8/bits/functional_hash.h:101:12: 附注:‘std::hash<std::tuple<int, int, int> >::hash()’ is implicitly deleted because the default definition would be ill-formed:
struct hash : __hash_enum<_Tp>
^~~~
/usr/include/c++/8/bits/functional_hash.h:101:12: 错误:no matching function for call to ‘std::__hash_enum<std::tuple<int, int, int>, false>::__hash_enum()’
/usr/include/c++/8/bits/functional_hash.h:82:7: 附注:candidate: ‘std::__hash_enum<_Tp, <匿名> >::__hash_enum(std::__hash_enum<_Tp, <匿名> >&&) [with _Tp = std::tuple<int, int, int>; bool <匿名> = false]’
__hash_enum(__hash_enum&&);
^~~~~~~~~~~
/usr/include/c++/8/bits/functional_hash.h:82:7: 附注: 备选需要 1 实参,但提供了 0 个
/usr/include/c++/8/bits/functional_hash.h:101:12: 错误:‘std::__hash_enum<_Tp, <匿名> >::~__hash_enum() [with _Tp = std::tuple<int, int, int>; bool <匿名> = false]’ is private within this context
struct hash : __hash_enum<_Tp>
^~~~
/usr/include/c++/8/bits/functional_hash.h:83:7: 附注:declared private here
~__hash_enum();
^
In file included from /usr/include/c++/8/bits/hashtable.h:35,
from /usr/include/c++/8/unordered_map:46,
from /usr/include/c++/8/functional:61,
from /usr/include/x86_64-linux-gnu/c++/8/bits/stdc++.h:71,
from /tmp/compiler_4quo9a7y/src:1:
/usr/include/c++/8/bits/hashtable_policy.h:1106:7: 错误:使用了被删除的函数‘std::hash<std::tuple<int, int, int> >::~hash()’
_Hashtable_ebo_helper() = default;
^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8/string_view:43,
from /usr/include/c++/8/bits/basic_string.h:48,
from /usr/include/c++/8/string:52,
from /usr/include/c++/8/bits/locale_classes.h:40,
from /usr/include/c++/8/bits/ios_base.h:41,
from /usr/include/c++/8/ios:42,
from /usr/include/c++/8/istream:38,
from /usr/include/c++/8/sstream:38,
from /usr/include/c++/8/complex:45,
from /usr/include/c++/8/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/8/bits/stdc++.h:52,
from /tmp/compiler_4quo9a7y/src:1:
/usr/include/c++/8/bits/functional_hash.h:101:12: 附注:‘std::hash<std::tuple<int, int, int>
...