c++ - 将 unordered_set_of 与 Boost.Bimap 一起使用时出错

标签 c++ boost bimap boost-bimap

我正在尝试关注 this example来自文档(请参阅 word_counter 的 typedef)。

#include <string>
#include <boost/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>

typedef boost::bimap
<
  boost::bimap::unordered_set_of< std::string >,
  std::string
> MyBimap;

抛出的错误是

test.cpp:11:1: error: wrong number of template arguments (1, should be 5) In file included from /usr/include/boost/bimap.hpp:13:0, from test.cpp:3: /usr/include/boost/bimap/bimap.hpp:133:7: error: provided for ‘template class boost::bimaps::bimap’ test.cpp:11:10: error: invalid type in declaration before ‘;’ token

最佳答案

你打错了。 而不是

boost::bimap::unordered_set_of< std::string >,

使用

boost::bimaps::unordered_set_of< std::string >,

在模板中。

然后它会编译。

关于c++ - 将 unordered_set_of 与 Boost.Bimap 一起使用时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20753302/

相关文章:

c++ - 使用 Raspberry Pi 和 Qt 的 Poco C++

c++ - 在每分钟开始时运行一个函数?

c++ - 用 Boost.Bimap 替换 vector 和哈希表

c++11 - 可变参数类型定义,或 "Bimaps done the C++0x way"

c++ - 使用抽象类 boost 二进制序列化问题

java - 我们使用 BiMap 解决的问题

c++ - 'while' 之前的意外不合格 ID

c++ - 如何使异步函数中使用其成员的shared_ptr对象保持事件状态?

c++ - 在类里面使用boost内存池

C++如何创建多态容器?