diff --git a/ogg/xiphcomment.cpp b/ogg/xiphcomment.cpp index 2de04cd5..5c99f957 100644 --- a/ogg/xiphcomment.cpp +++ b/ogg/xiphcomment.cpp @@ -202,7 +202,7 @@ void Ogg::XiphComment::removeField(const String &key, const String &value) } } else - d->fieldListMap[key].clear(); + d->fieldListMap.erase(key); } bool Ogg::XiphComment::contains(const String &key) const diff --git a/toolkit/tmap.h b/toolkit/tmap.h index 55731ee4..9daf979c 100644 --- a/toolkit/tmap.h +++ b/toolkit/tmap.h @@ -131,6 +131,11 @@ namespace TagLib { */ Map &erase(Iterator it); + /*! + * Erase the item with \a key from the list. + */ + Map &erase(const Key &key); + /*! * Returns a reference to the value associated with \a key. * diff --git a/toolkit/tmap.tcc b/toolkit/tmap.tcc index afb7db4c..e2755d6f 100644 --- a/toolkit/tmap.tcc +++ b/toolkit/tmap.tcc @@ -130,6 +130,14 @@ Map &Map::erase(Iterator it) return *this; } +template +Map &Map::erase(const Key &key) +{ + detach(); + d->map.erase(find(key)); + return *this; +} + template TagLib::uint Map::size() const {