Skip to content

Commit 1d1e43c

Browse files
Merge pull request #911 from epam/feature/521_std_multimap_molfile_loader
Issue #521: core: replace MultiMap in MolfileLoader class
2 parents b0851a8 + a826052 commit 1d1e43c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/indigo-core/molecule/src/molfile_loader.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -3002,28 +3002,28 @@ void MolfileLoader::_fillSGroupsParentIndices()
30023002
{
30033003
MoleculeSGroups& sgroups = _bmol->sgroups;
30043004

3005-
MultiMap<int, int> indices;
3005+
std::multimap<int, int> indices;
30063006
// original index can be arbitrary, sometimes key is used multiple times
30073007

30083008
for (auto i = sgroups.begin(); i != sgroups.end(); i++)
30093009
{
30103010
SGroup& sgroup = sgroups.getSGroup(i);
3011-
indices.insert(sgroup.original_group, i);
3011+
indices.emplace(sgroup.original_group, i);
30123012
}
30133013

30143014
// TODO: replace parent_group with parent_idx
30153015
for (auto i = sgroups.begin(); i != sgroups.end(); i = sgroups.next(i))
30163016
{
30173017
SGroup& sgroup = sgroups.getSGroup(i);
3018-
const auto& set = indices.get(sgroup.parent_group);
3019-
if (set.size() == 1)
3018+
if (indices.count(sgroup.parent_group) == 1)
30203019
{
3020+
const auto it = indices.find(sgroup.parent_group);
30213021
// TODO: check fix
3022-
auto parent_idx = set.key(set.begin());
3022+
auto parent_idx = it->second;
30233023
SGroup& parent_sgroup = sgroups.getSGroup(parent_idx);
30243024
if (&sgroup != &parent_sgroup)
30253025
{
3026-
sgroup.parent_idx = set.key(set.begin());
3026+
sgroup.parent_idx = it->second;
30273027
}
30283028
else
30293029
{

0 commit comments

Comments
 (0)