Index: src/Common/ScopedMap.h
===================================================================
--- src/Common/ScopedMap.h	(revision e9b50434ce6bdadbbeec1c812d5b5c1b1322637d)
+++ src/Common/ScopedMap.h	(revision 21a2a7d9c6395caabfb563f85756ba506c922512)
@@ -167,5 +167,11 @@
 	}
 
-	iterator erase( iterator pos );
+	/// Erases element with key in the innermost scope that has it.
+	size_type erase( const Key & key ) {
+		for ( auto it = scopes.rbegin() ; it != scopes.rend() ; ++it ) {
+			if ( size_type i = it->map.erase( key ) ; 0 != i ) return i;
+		}
+		return 0;
+	}
 
 	size_type count( const Key & key ) const {
@@ -345,13 +351,4 @@
 };
 
-template<typename Key, typename Value, typename Note>
-typename ScopedMap<Key, Value, Note>::iterator
-		ScopedMap<Key, Value, Note>::erase( iterator pos ) {
-	MapType & scope = (*pos.scopes)[ pos.level ].map;
-	const typename iterator::wrapped_iterator & new_it = scope.erase( pos.it );
-	iterator it( *pos.scopes, new_it, pos.level );
-	return it.next_valid();
-}
-
 // Local Variables: //
 // tab-width: 4 //
