diff --git a/core/indigo-core/molecule/src/molfile_saver.cpp b/core/indigo-core/molecule/src/molfile_saver.cpp index d12da6366e..85b278bfbb 100644 --- a/core/indigo-core/molecule/src/molfile_saver.cpp +++ b/core/indigo-core/molecule/src/molfile_saver.cpp @@ -19,6 +19,7 @@ #include "molecule/molfile_saver.h" #include +#include #include #include "base_cpp/locale_guard.h" @@ -2000,7 +2001,7 @@ void MolfileSaver::_writeAttachmentValues2000(Output& output, BaseMolecule& frag if (fragment.attachmentPointCount() == 0) return; - RedBlackMap orders; + std::map orders; int i; for (i = 1; i <= fragment.attachmentPointCount(); i++) @@ -2010,10 +2011,11 @@ void MolfileSaver::_writeAttachmentValues2000(Output& output, BaseMolecule& frag while ((idx = fragment.getAttachmentPoint(i, j++)) != -1) { - int* val; + auto it = orders.find(_atom_mapping[idx]); + int* val = it != orders.end() ? &(it->second) : nullptr; - if ((val = orders.at2(_atom_mapping[idx])) == 0) - orders.insert(_atom_mapping[idx], 1 << (i - 1)); + if (!val) + orders.emplace(_atom_mapping[idx], 1 << (i - 1)); else *val |= 1 << (i - 1); } @@ -2021,8 +2023,8 @@ void MolfileSaver::_writeAttachmentValues2000(Output& output, BaseMolecule& frag output.printf("M APO%3d", orders.size()); - for (i = orders.begin(); i < orders.end(); i = orders.next(i)) - output.printf(" %3d %3d", orders.key(i), orders.value(i)); + for (auto it = orders.begin(); it != orders.end(); it++) + output.printf(" %3d %3d", it->first, it->second); output.writeCR(); }