繁体   English   中英

boost :: unordered_map()的find()方法上的问题

[英]problems on the find() method of boost::unordered_map()

我有以下代码:

typedef unsigned char tTerm;
typedef uint64_t nTerm;

boost::unordered_map<tTerm *, nTerm> map;

nTerm function(tTerm * key) {
  boost::unordered_map<tTerm *, nTerm>::iterator it = standardTerms.find(key);
    if (it != standardTerms.end()) {
      return it->second;
  }
}

此代码使用clang正确编译(在MacO中)。 但是,eclipse会警告find()方法的调用方式存在问题。 更特别的是,它通过重现错误来警告使用不兼容的参数调用find():

“无效的参数'候选者是:boost :: unordered :: iterator_detail :: iterator >> find(const unsigned char&)boost :: unordered :: iterator_detail :: c_iterator>,const boost :: unordered :: detail :: ptr_node> *>查找(const unsigned char&)boost :: unordered :: iterator_detail :: iterator >> find(const#10000&,const#10001&,const#10002&)boost :: unordered :: iterator_detail :: c_iterator>, const boost :: unordered :: detail :: ptr_node> *> find(const#10000&,const#10001&,const#10002&)'“

现在,所有代码都可以正确编译,因此可能是eclipse bug。 但是,通过忽略此消息,我可能会错过一些重要的事情。 你怎么看?

没什么好担心的。 对我来说看起来正确。 您可以将指针用作键。 我认为这是日食的错。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM