diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index bbe32e46e0..1421a2e2a4 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -1732,7 +1732,8 @@ void IfcFile::removeEntity(IfcUtil::IfcBaseClass* entity) { entities_by_ref_t::iterator byref_it = byref.find(name); if (byref_it != byref.end()) { std::vector& ids = byref_it->second; - std::remove(ids.begin(), ids.end(), name); + std::vector::const_iterator removed_from = std::remove(ids.begin(), ids.end(), id); + ids.erase(removed_from, ids.end()); } } }