Skip to content

Commit

Permalink
Merge pull request #911 from epam/feature/521_std_multimap_molfile_lo…
Browse files Browse the repository at this point in the history
…ader

Issue #521: core: replace MultiMap  in MolfileLoader class
  • Loading branch information
MysterionRise authored Dec 2, 2022
2 parents b0851a8 + a826052 commit 1d1e43c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/indigo-core/molecule/src/molfile_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3002,28 +3002,28 @@ void MolfileLoader::_fillSGroupsParentIndices()
{
MoleculeSGroups& sgroups = _bmol->sgroups;

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

for (auto i = sgroups.begin(); i != sgroups.end(); i++)
{
SGroup& sgroup = sgroups.getSGroup(i);
indices.insert(sgroup.original_group, i);
indices.emplace(sgroup.original_group, i);
}

// TODO: replace parent_group with parent_idx
for (auto i = sgroups.begin(); i != sgroups.end(); i = sgroups.next(i))
{
SGroup& sgroup = sgroups.getSGroup(i);
const auto& set = indices.get(sgroup.parent_group);
if (set.size() == 1)
if (indices.count(sgroup.parent_group) == 1)
{
const auto it = indices.find(sgroup.parent_group);
// TODO: check fix
auto parent_idx = set.key(set.begin());
auto parent_idx = it->second;
SGroup& parent_sgroup = sgroups.getSGroup(parent_idx);
if (&sgroup != &parent_sgroup)
{
sgroup.parent_idx = set.key(set.begin());
sgroup.parent_idx = it->second;
}
else
{
Expand Down

0 comments on commit 1d1e43c

Please sign in to comment.