ScummVM API documentation
Common::StableMap< Key, Val, CompFunc > Class Template Reference

#include <stablemap.h>

Public Types

using value_type = Pair< Key, Val >
 
using iterator = typename TreeT::BasicIterator
 
using const_iterator = typename TreeT::ConstIterator
 

Public Member Functions

void clear ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator lower_bound (const Key &key) const
 
iterator lower_bound (const Key &key)
 
iterator upper_bound (const Key &key)
 
iterator find (const Key &theKey)
 
const_iterator find (const Key &theKey) const
 
Val & operator[] (const Key &theKey)
 
iterator erase (iterator it)
 
iterator erase (iterator first, iterator last)
 
size_t erase (const Key &theKey)
 
Pair< iterator, bool > insert (const value_type &val)
 
size_t size () const
 
bool empty () const
 
size_t count (const Key &key)
 

Detailed Description

template<class Key, class Val, class CompFunc = Common::Less<Key>>
class Common::StableMap< Key, Val, CompFunc >

Ordered associative container meant as a drop-in replacement for the C++ standard library's std::map.

Member Typedef Documentation

◆ value_type

template<class Key, class Val, class CompFunc = Common::Less<Key>>
using Common::StableMap< Key, Val, CompFunc >::value_type = Pair<Key, Val>

Type of the value obtained by dereferencing a StableMap iterator.

◆ iterator

template<class Key, class Val, class CompFunc = Common::Less<Key>>
using Common::StableMap< Key, Val, CompFunc >::iterator = typename TreeT::BasicIterator

StableMap iterator.

◆ const_iterator

template<class Key, class Val, class CompFunc = Common::Less<Key>>
using Common::StableMap< Key, Val, CompFunc >::const_iterator = typename TreeT::ConstIterator

Const-qualified StableMap iterator.

Member Function Documentation

◆ clear()

template<class Key, class Val, class CompFunc = Common::Less<Key>>
void Common::StableMap< Key, Val, CompFunc >::clear ( )
inline

Clears the contents of the map

◆ begin() [1/2]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
iterator Common::StableMap< Key, Val, CompFunc >::begin ( )
inline

Return an iterator pointing to the first element in the map.

◆ end() [1/2]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
iterator Common::StableMap< Key, Val, CompFunc >::end ( )
inline

Return an iterator pointing to the last element in the map.

◆ begin() [2/2]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
const_iterator Common::StableMap< Key, Val, CompFunc >::begin ( ) const
inline

Return a const iterator pointing to the first element in the map.

◆ end() [2/2]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
const_iterator Common::StableMap< Key, Val, CompFunc >::end ( ) const
inline

Return a const iterator pointing to the last element in the map.

◆ lower_bound() [1/2]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
const_iterator Common::StableMap< Key, Val, CompFunc >::lower_bound ( const Key &  key) const
inline

Returns an iterator to the first item thas is not less than key in the map (or end() if this cannot be found).

◆ lower_bound() [2/2]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
iterator Common::StableMap< Key, Val, CompFunc >::lower_bound ( const Key &  key)
inline

Returns a const iterator to the first item thas is not less than key in the map (or end() if this cannot be found).

◆ upper_bound()

template<class Key, class Val, class CompFunc = Common::Less<Key>>
iterator Common::StableMap< Key, Val, CompFunc >::upper_bound ( const Key &  key)
inline

Returns an iterator to the first item bigger than key in the map (or end() if this cannot be found).

◆ find() [1/2]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
iterator Common::StableMap< Key, Val, CompFunc >::find ( const Key &  theKey)
inline

Returns an iterator to the item with the given key, or end() if the item was not found.

◆ find() [2/2]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
const_iterator Common::StableMap< Key, Val, CompFunc >::find ( const Key &  theKey) const
inline

Returns a const iterator to the item with the given key, or end() if the item was not found.

◆ operator[]()

template<class Key, class Val, class CompFunc = Common::Less<Key>>
Val& Common::StableMap< Key, Val, CompFunc >::operator[] ( const Key &  theKey)
inline

Square brackets operator accesses items by key, creating if necessary

◆ erase() [1/3]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
iterator Common::StableMap< Key, Val, CompFunc >::erase ( iterator  it)
inline

Erases the item in the map pointed by it .

◆ erase() [2/3]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
iterator Common::StableMap< Key, Val, CompFunc >::erase ( iterator  first,
iterator  last 
)
inline

Erase the elements from first to last and return an iterator pointing to the next element in the map.

Note
If [first, last) is not a valid range for the map, the behaviour is undefined.

◆ erase() [3/3]

template<class Key, class Val, class CompFunc = Common::Less<Key>>
size_t Common::StableMap< Key, Val, CompFunc >::erase ( const Key &  theKey)
inline

Erases the item with the given key. Returns the number of elements removed (0 or 1)

◆ insert()

template<class Key, class Val, class CompFunc = Common::Less<Key>>
Pair<iterator, bool> Common::StableMap< Key, Val, CompFunc >::insert ( const value_type val)
inline

Tries to insert the value val in the map. If the value is inserted, the pair (it, true), where it is the iterator to the inserted value, is returned, otherwise (lower_bound(val), false) is returned

◆ size()

template<class Key, class Val, class CompFunc = Common::Less<Key>>
size_t Common::StableMap< Key, Val, CompFunc >::size ( ) const
inline

Returns the size of the map.

◆ empty()

template<class Key, class Val, class CompFunc = Common::Less<Key>>
bool Common::StableMap< Key, Val, CompFunc >::empty ( ) const
inline

Returns true if the map is empty. Shorthand for:

map.size() == 0

◆ count()

template<class Key, class Val, class CompFunc = Common::Less<Key>>
size_t Common::StableMap< Key, Val, CompFunc >::count ( const Key &  key)
inline

Returns the number of elements with a matching key


The documentation for this class was generated from the following file: