0
我在Key.h
为什么没有被正确创建一对 - C++
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]`
有什么想法?
这是真的......我应该从'uint64'投到'uint64_t'吗? – cybertextron 2013-02-22 18:45:04
我会改正错字! – 2013-02-22 18:48:50