Changeset db9d7a9
- Timestamp:
- Feb 3, 2023, 12:24:01 PM (22 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 2125443a
- Parents:
- 85dd381
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/ScopedMap.h
r85dd381 rdb9d7a9 46 46 typedef std::vector< Scope > ScopeList; 47 47 48 ScopeList scopes; ///< scoped list of maps 48 /// Scoped list of maps. 49 ScopeList scopes; 49 50 public: 50 51 typedef typename MapType::key_type key_type; … … 146 147 } 147 148 148 template< typename value_type_t >149 std::pair< iterator, bool > insert( iterator at, value_type_t && value ) {150 MapType & scope = (*at.scopes)[ at.level ].map;151 std::pair< typename MapType::iterator, bool > res = scope.insert( std::forward<value_type_t>( value ) );152 return std::make_pair( iterator(scopes, std::move( res.first ), at.level), std::move( res.second ) );153 }154 155 149 template< typename value_t > 156 150 std::pair< iterator, bool > insert( const Key & key, value_t && value ) { return insert( std::make_pair( key, std::forward<value_t>( value ) ) ); } … … 173 167 } 174 168 175 iterator erase( iterator pos ) { 176 MapType & scope = (*pos.scopes)[ pos.level ].map; 177 const typename iterator::wrapped_iterator & new_it = scope.erase( pos.it ); 178 iterator it( *pos.scopes, new_it, pos.level ); 179 return it.next_valid(); 180 } 169 iterator erase( iterator pos ); 181 170 182 171 size_type count( const Key & key ) const { … … 352 341 }; 353 342 343 template<typename Key, typename Value, typename Note> 344 typename ScopedMap<Key, Value, Note>::iterator 345 ScopedMap<Key, Value, Note>::erase( iterator pos ) { 346 MapType & scope = (*pos.scopes)[ pos.level ].map; 347 const typename iterator::wrapped_iterator & new_it = scope.erase( pos.it ); 348 iterator it( *pos.scopes, new_it, pos.level ); 349 return it.next_valid(); 350 } 351 354 352 // Local Variables: // 355 353 // tab-width: 4 //
Note: See TracChangeset
for help on using the changeset viewer.