- bool empty() const
- {
- return m_values.empty();
- }
- std::size_t size() const
- {
- return m_values.size();
- }
- void clear()
- {
- m_values.clear();
- }
+iterator insert( const value_type& value ){
+ ASSERT_MESSAGE( find( value.first ) == end(), "UnsortedMap::insert: already added" );
+ m_values.push_back( value );
+ return --m_values.end();
+}
+void erase( const Key& key ){
+ iterator i = find( key );
+ ASSERT_MESSAGE( i != end(), "UnsortedMap::erase: not found" );
+ erase( i );
+}
+void erase( iterator i ){
+ m_values.erase( i );
+}
+iterator find( const Key& key ){
+ for ( iterator i = m_values.begin(); i != m_values.end(); ++i )
+ {
+ if ( ( *i ).first == key ) {
+ return i;
+ }
+ }
+ return m_values.end();
+}
+const_iterator find( const Key& key ) const {
+ for ( const_iterator i = m_values.begin(); i != m_values.end(); ++i )
+ {
+ if ( ( *i ).first == key ) {
+ return i;
+ }
+ }
+ return m_values.end();
+}