multi index table の indexed_by による並べ替えの適用範囲
もともと indexed_by がついていなかったマルチインデックスに新しく indexed_by をつけてコンパイルし直しても、もともとテーブルに保管されていたデータに関しては並び替えが適用されず、その後 emplace した row のみが並び変えられる(modify した row にすら適用されない)。この点で、
code:sample1.cpp
auto& table_data = table.get( id );
table.modify( table_data, ram_payer, &(auto& data) { data.id = id;
});
code:sample2.cpp
auto& table_data = table.get( id );
table.erase( table_data );
table.emplace( ram_payer, &(auto& data) { data.id = id;
});
という2つの処理は異なる(どちらも、該当する row の RAM 負担者を ram_payer に替える処理をしている)。
関連ワード