【发布时间】:2011-05-11 12:26:28
【问题描述】:
我很难理解 Boost.MultiIndex 是如何实现的。假设我有以下内容:
typedef multi_index_container<
employee,
indexed_by<
ordered_unique<member<employee, std::string, &employee::name> >,
ordered_unique<member<employee, int, &employee::age> >
>
> employee_set;
我想我有一个数组Employee[],它实际上存储了employee 对象和两个映射
map<std::string, employee*>
map<int, employee*>
以姓名和年龄为键。每个映射都有employee* 值,它指向数组中存储的对象。这样可以吗?
【问题讨论】:
-
int是原始类型。它不在std::命名空间中。
标签: c++ boost multi-index boost-multi-index