在下面的代码中:
typedef bimap< set_of< std::string >, list_of< int > > bm_type;
bm_type bm;
bm.left["one"] = 1; // "one" -> 1
bm.left["one"] = 2; // replaced: "one" -> 2
bm.right[2] = "two"; // Compile error
如何消除编译错误?不是可以用operator[]
访问正确的 View 吗?
最佳答案
list_of
没有 operator[]
。
关于c++ - Boost:使用运算符[]访问bimap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13799350/