Index: src/GenPoly/ScopedMap.h
===================================================================
--- src/GenPoly/ScopedMap.h	(revision f18a7116aa1cfebf9345699d96b99221a153dc0f)
+++ src/GenPoly/ScopedMap.h	(revision b542bfb3722bdbb64bd16d352ff9d563d92afb57)
@@ -42,5 +42,5 @@
 		typedef typename Scope::pointer pointer;
 		typedef typename Scope::const_pointer const_pointer;
-		
+
 		class iterator : public std::iterator< std::bidirectional_iterator_tag,
 		                                       value_type > {
@@ -68,5 +68,5 @@
 			}
 
-			iterator(scope_list const &_scopes, const wrapped_iterator &_it, size_type _i)
+			iterator(scope_list &_scopes, const wrapped_iterator &_it, size_type _i)
 				: scopes(&_scopes), it(_it), i(_i) {}
 		public:
@@ -76,5 +76,5 @@
 				return *this;
 			}
-			
+
 			reference operator* () { return *it; }
 			pointer operator-> () { return it.operator->(); }
@@ -109,5 +109,5 @@
 
 		private:
-			scope_list const *scopes;
+			scope_list *scopes;
 			wrapped_iterator it;
 			size_type i;
@@ -189,9 +189,8 @@
 			size_type i;
 		};
-		
+
 		/// Starts a new scope
 		void beginScope() {
-			Scope scope;
-			scopes.push_back(scope);
+			scopes.emplace_back();
 		}
 
@@ -227,5 +226,5 @@
 				return const_iterator( const_cast< ScopedMap< Key, Value >* >(this)->find( key ) );
 		}
-		
+
 		/// Finds the given key in the outermost scope inside the given scope where it occurs
 		iterator findNext( const_iterator &it, const Key &key ) {
@@ -247,5 +246,12 @@
 			return std::make_pair( iterator(scopes, res.first, scopes.size()-1), res.second );
 		}
+
+		std::pair< iterator, bool > insert( value_type &&value ) {
+			std::pair< typename Scope::iterator, bool > res = scopes.back().insert( std::move( value ) );
+			return std::make_pair( iterator(scopes, std::move( res.first ), scopes.size()-1), std::move( res.second ) );
+		}
+
 		std::pair< iterator, bool > insert( const Key &key, const Value &value ) { return insert( std::make_pair( key, value ) ); }
+		std::pair< iterator, bool > insert( const Key &key, Value &&value ) { return insert( std::make_pair( key, std::move( value ) ) ); }
 
 		Value& operator[] ( const Key &key ) {
@@ -254,4 +260,25 @@
 			return insert( key, Value() ).first->second;
 		}
+
+		iterator erase( iterator pos ) {
+			Scope& scope = (*pos.scopes) [ pos.i ];
+			const typename iterator::wrapped_iterator& new_it = scope.erase( pos.it );
+			iterator it( *pos.scopes, new_it, pos.i );
+			return it.next_valid();
+		}
+
+		size_type count( const Key &key ) const {
+			size_type c = 0;
+			auto it = find( key );
+			auto end = cend();
+
+			while(it != end) {
+				c++;
+				it = findNext(it, key);
+			}
+
+			return c;
+		}
+
 	};
 } // namespace GenPoly
