我使用升压1.48.0,和我没有升级选项。
我已经建立了与有重叠的标准索引的multi_index_container的。 指标是如何实现共享相同索引的标准,如下面的例子吗? 示例代码的最后一行暗示什么,我要求。
struct street_address_key : composite_key<
t_postal_address
, const_mem_fun<const_mem_fun<t_postal_address, string, &t_postal_address::street_name>>
, const_mem_fun<const_mem_fun<t_postal_address, long, &t_postal_address::house_number>>
, const_mem_fun<const_mem_fun<t_postal_address, string, &t_postal_address::city>>
, const_mem_fun<const_mem_fun<t_postal_address, string, &t_postal_address::state>>
, const_mem_fun<const_mem_fun<t_postal_address, long, &t_postal_address::zip_code>>
> {};
multi_index<
t_postal_address
indexed_by<
ordered_unique<street_address_key>
, ordered_non_unique<const_mem_fun<t_postal_address, string, &t_postal_address::name>>
, ordered_non_unique<const_mem_fun<const_mem_fun<t_postal_address, string, &t_postal_address::street_name>>
, ordered_non_unique<const_mem_fun<const_mem_fun<t_postal_address, long, &t_postal_address::house_number>>
, ordered_non_unique<const_mem_fun<const_mem_fun<t_postal_address, string, &t_postal_address::city>>
, ordered_non_unique<const_mem_fun<const_mem_fun<t_postal_address, string, &t_postal_address::state>>
, ordered_non_unique<const_mem_fun<const_mem_fun<t_postal_address, long, &t_postal_address::zip_code>>
>
> t_address_book;
...
t_address_book::nth_element<0>::type::iterator address_iter = book.find(some_address_tuple);
book.modify(address_iter, modify_city_method);
auto city_range = book.get<4>().equal_range( \*???*\ );
市指标股的相同的标准street_address_key。 通过street_address_key修改,按照我的理解,将确保该指数被适当地更新。 但什么是“城市”指标的状态? 被更新,以反映城市名称的变化? 或者是在一个破碎的状态? 我仍然可以找到与老城区同一地址索引? 我必须单独更新这个指数? 我可以打电话给无操作修改更新索引?
// Presume I have the city element from the index.
// Is this supposed to update the city index after it was modified above?
book.get<4>().modify(city_iter, [](t_postal_address &) {});