From 172f46f6795497215bfac72c1d17c3db64179d82 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 11 Apr 2013 14:27:32 +0200 Subject: [PATCH] idvaluemap: add a remove_all method --- src/idvaluemap.hh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/idvaluemap.hh b/src/idvaluemap.hh index aff64412..3a263c6e 100644 --- a/src/idvaluemap.hh +++ b/src/idvaluemap.hh @@ -54,14 +54,15 @@ public: void remove(const Id& id) { - for (auto it = m_content.begin(); it != m_content.end(); ++it) - { - if (it->first == id) - { - m_content.erase(it); - return; - } - } + auto it = find(id); + if (it != end()) + m_content.erase(it); + } + + void remove_all(const Id& id) + { + for (auto it = find(id); it != end(); it = find(id)) + m_content.erase(it); } template