#include #include #include "StereoGroup.h" namespace RDKit { StereoGroup::StereoGroup(StereoGroupType grouptype, std::vector &&atoms) : d_grouptype(grouptype), d_atoms(atoms) {} StereoGroup::StereoGroup(StereoGroupType grouptype, const std::vector &atoms) : d_grouptype(grouptype), d_atoms(std::move(atoms)) {} StereoGroupType StereoGroup::getGroupType() const { return d_grouptype; } const std::vector &StereoGroup::getAtoms() const { return d_atoms; } void removeGroupsWithAtom(const Atom *atom, std::vector &groups) { auto containsAtom = [atom](const StereoGroup &group) { return std::find(group.getAtoms().cbegin(), group.getAtoms().cend(), atom) != group.getAtoms().cend(); }; groups.erase(std::remove_if(groups.begin(), groups.end(), containsAtom), groups.end()); } void removeGroupsWithAtoms(const std::vector &atoms, std::vector &groups) { auto containsAnyAtom = [&atoms](const StereoGroup &group) { for (auto atom : atoms) { if (std::find(group.getAtoms().cbegin(), group.getAtoms().cend(), atom) != group.getAtoms().cend()) { return true; } } return false; }; groups.erase(std::remove_if(groups.begin(), groups.end(), containsAnyAtom), groups.end()); } } // namespace RDKit