【发布时间】:2014-09-16 15:50:27
【问题描述】:
我正在寻找一个双向无序映射。目前,我只有这个。问题是,我不能使用[]。我认为 boost 默认为列表类型。但我想要一个哈希图。这怎么可能?
#include <string>
#include <boost/bimap.hpp>
boost::bimap<std::string, size_t> indices;
// ...
size_t index = 42;
indices.right[index].second = "name"; // This doesn't work.
在overview page 上,我发现unordered_set_of 使bimap 表现得像一个hashmap。但是,一旦插入,我就无法修改值。
【问题讨论】:
标签: c++ boost hashmap boost-bimap