This class implements a map that also provides access to all stored values in a deterministic order.
More...
|
| VectorType | takeVector () |
| | Clear the MapVector and return the underlying vector.
|
| |
| size_type | size () const |
| |
| void | reserve (size_type NumEntries) |
| | Grow the MapVector so that it can contain at least NumEntries items before resizing again.
|
| |
| iterator | begin () |
| |
| const_iterator | begin () const |
| |
| iterator | end () |
| |
| const_iterator | end () const |
| |
| reverse_iterator | rbegin () |
| |
| const_reverse_iterator | rbegin () const |
| |
| reverse_iterator | rend () |
| |
| const_reverse_iterator | rend () const |
| |
| bool | empty () const |
| |
| std::pair< KeyT, ValueT > & | front () |
| |
| const std::pair< KeyT, ValueT > & | front () const |
| |
| std::pair< KeyT, ValueT > & | back () |
| |
| const std::pair< KeyT, ValueT > & | back () const |
| |
| void | clear () |
| |
| void | swap (MapVector &RHS) |
| |
| ValueT & | operator[] (const KeyT &Key) |
| |
| ValueT | lookup (const KeyT &Key) const |
| |
| template<typename... Ts> |
| std::pair< iterator, bool > | try_emplace (const KeyT &Key, Ts &&...Args) |
| |
| template<typename... Ts> |
| std::pair< iterator, bool > | try_emplace (KeyT &&Key, Ts &&...Args) |
| |
| std::pair< iterator, bool > | insert (const std::pair< KeyT, ValueT > &KV) |
| |
| std::pair< iterator, bool > | insert (std::pair< KeyT, ValueT > &&KV) |
| |
| template<typename V > |
| std::pair< iterator, bool > | insert_or_assign (const KeyT &Key, V &&Val) |
| |
| template<typename V > |
| std::pair< iterator, bool > | insert_or_assign (KeyT &&Key, V &&Val) |
| |
| bool | contains (const KeyT &Key) const |
| |
| size_type | count (const KeyT &Key) const |
| |
| iterator | find (const KeyT &Key) |
| |
| const_iterator | find (const KeyT &Key) const |
| |
| void | pop_back () |
| | Remove the last element from the vector.
|
| |
| VectorType::iterator | erase (typename VectorType::iterator Iterator) |
| | Remove the element given by Iterator.
|
| |
| size_type | erase (const KeyT &Key) |
| | Remove all elements with the key value Key.
|
| |
| template<class Predicate > |
| void | remove_if (Predicate Pred) |
| | Remove the elements that match the predicate.
|
| |
| template<class Function > |
| void | remove_if (Function Pred) |
| |
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.