This class implements a map that also provides access to all stored values in a deterministic order.
More...
template<typename KeyT, typename ValueT, typename MapType = DenseMap<KeyT, unsigned>, typename VectorType = SmallVector<std::pair<KeyT, ValueT>, 0>>
class wpi::MapVector< KeyT, ValueT, MapType, VectorType >
This class implements a map that also provides access to all stored values in a deterministic order.
The values are kept in a SmallVector<*, 0> and the mapping is done with DenseMap from Keys to indexes in that vector.
template<typename KeyT , typename ValueT , typename MapType = DenseMap<KeyT, unsigned>, typename VectorType = SmallVector<std::pair<KeyT, ValueT>, 0>>
Remove all elements with the key value Key.
Returns the number of elements removed.
template<typename KeyT , typename ValueT , typename MapType = DenseMap<KeyT, unsigned>, typename VectorType = SmallVector<std::pair<KeyT, ValueT>, 0>>
VectorType::iterator wpi::MapVector< KeyT, ValueT, MapType, VectorType >::erase |
( |
typename VectorType::iterator |
Iterator | ) |
|
|
inline |
Remove the element given by Iterator.
Returns an iterator to the element following the one which was removed, which may be end().
- Note
- This is a deceivingly expensive operation (linear time). It's usually better to use remove_if() if possible.
template<typename KeyT , typename ValueT , typename MapType = DenseMap<KeyT, unsigned>, typename VectorType = SmallVector<std::pair<KeyT, ValueT>, 0>>
void wpi::MapVector< KeyT, ValueT, MapType, VectorType >::pop_back |
( |
| ) |
|
|
inline |
Remove the last element from the vector.
template<typename KeyT , typename ValueT , typename MapType = DenseMap<KeyT, unsigned>, typename VectorType = SmallVector<std::pair<KeyT, ValueT>, 0>>
template<class Function >
void wpi::MapVector< KeyT, ValueT, MapType, VectorType >::remove_if |
( |
Function |
Pred | ) |
|
template<typename KeyT , typename ValueT , typename MapType = DenseMap<KeyT, unsigned>, typename VectorType = SmallVector<std::pair<KeyT, ValueT>, 0>>
template<class Predicate >
void wpi::MapVector< KeyT, ValueT, MapType, VectorType >::remove_if |
( |
Predicate |
Pred | ) |
|
Remove the elements that match the predicate.
Erase all elements that match Pred
in a single pass. Takes linear time.
template<typename KeyT , typename ValueT , typename MapType = DenseMap<KeyT, unsigned>, typename VectorType = SmallVector<std::pair<KeyT, ValueT>, 0>>
Grow the MapVector so that it can contain at least NumEntries
items before resizing again.
template<typename KeyT , typename ValueT , typename MapType = DenseMap<KeyT, unsigned>, typename VectorType = SmallVector<std::pair<KeyT, ValueT>, 0>>
VectorType wpi::MapVector< KeyT, ValueT, MapType, VectorType >::takeVector |
( |
| ) |
|
|
inline |
Clear the MapVector and return the underlying vector.