ブースト 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 を介して変更すると、インデックスが適切に更新されます。しかし、「都市」インデックスの状態はどうですか? 都市名の変更を反映して更新されましたか? それとも壊れた状態ですか?旧市街と同じ住所インデックスを見つけることはできますか? このインデックスを個別に更新する必要がありますか? no-op Modifier を呼び出してインデックスを更新できますか?
// 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 &) {});