我有以下声明Key.h
typedef uint64_t KeyHash;
在我的Finder
课堂上,我有一个C++
声明如下的地图:
std::map<std::pair<uint64_t, KeyHash>, Foo> table;
因此,我正在尝试创建一个新的对。该Foo
对象有两个字段,startKeyHash
和foo_id
,都是类型uint64_t
:
std::pair<uint64_t, KeyHash> key (foo.foo_id,
foo.start_key_hash());
table[key] = tablet;
函数uint64_t Foo:start_key_hash()
返回startKeyHash
. 但是,当我编译代码时,出现以下错误:
error: no matching function for call to ‘std::pair<long unsigned int, long unsigned int>::pair(<unresolved overloaded function type>, google::protobuf::uint64)’
/usr/lib/gcc/x86_64-redhat-`linux/4.4.6/../../../../include/c++/4.4.6/bits/stl_pair.h:111: note:
candidates are: std::pair<_T1, _T2>::pair(_U1&&, _Arg0&&, _Args&& ...) [with _U1 =
google::protobuf::uint64, _Args = , _T1 = long unsigned int, _T2 = long unsigned int]`
有什么想法吗?