mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-07-17 19:56:38 -04:00
enriched more Ini UT, fixed value remove issue .
This commit is contained in:
parent
a2571dfc0f
commit
c3a31ef172
3 changed files with 108 additions and 3 deletions
|
@ -172,14 +172,17 @@ public:
|
|||
|
||||
void RemoveAt(size_t idx) {
|
||||
ASSERT(idx < value_pairs.size());
|
||||
for (auto affectedIdx = idx + 1; affectedIdx < value_pairs.size(); ++affectedIdx) {
|
||||
// delete from record first;
|
||||
auto const& pair = value_pairs.at(idx);
|
||||
ASSERT(value_pos.erase(pair.first) == 1);
|
||||
value_pairs.erase(value_pairs.begin() + idx);
|
||||
// now update all key-pos indexing, dec 1
|
||||
for (auto affectedIdx = idx; affectedIdx < value_pairs.size(); ++affectedIdx) {
|
||||
auto const& kvPair = value_pairs[affectedIdx];
|
||||
auto const it = value_pos.find(kvPair.first);
|
||||
ASSERT(it != value_pos.end());
|
||||
it->second--;
|
||||
}
|
||||
auto const itErased = value_pairs.erase(value_pairs.begin() + idx);
|
||||
ASSERT(value_pos.erase(itErased->first) == 1);
|
||||
}
|
||||
|
||||
void RemoveByKey(const CString& key) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue