class MapVector

Declaration

template <typename KeyT,
          typename ValueT,
          typename MapType = DenseMap<KeyT, unsigned int>,
          typename VectorType = std::vector<std::pair<KeyT, ValueT>>>
class MapVector { /* full declaration omitted */ };

Description

This class implements a map that also provides access to all stored values in a deterministic order. The values are kept in a std::vector and the mapping is done with DenseMap from Keys to indexes in that vector.

Declared at: llvm/include/llvm/ADT/MapVector.h:37

Templates

KeyT
ValueT
MapType = DenseMap<KeyT, unsigned int>
VectorType = std::vector<std::pair<KeyT, ValueT>>

Member Variables

private MapType Map
private VectorType Vector

Method Overview

  • public const std::pair<KeyT, ValueT> & back() const
  • public std::pair<KeyT, ValueT> & back()
  • public llvm::MapVector::iterator begin()
  • public llvm::MapVector::const_iterator begin() const
  • public void clear()
  • public llvm::MapVector::size_type count(const KeyT & Key) const
  • public bool empty() const
  • public llvm::MapVector::const_iterator end() const
  • public llvm::MapVector::iterator end()
  • public typename VectorType::iterator erase(typename VectorType::iterator Iterator)
  • public llvm::MapVector::size_type erase(const KeyT & Key)
  • public llvm::MapVector::const_iterator find(const KeyT & Key) const
  • public llvm::MapVector::iterator find(const KeyT & Key)
  • public std::pair<KeyT, ValueT> & front()
  • public const std::pair<KeyT, ValueT> & front() const
  • public std::pair<iterator, bool> insert(const std::pair<KeyT, ValueT> & KV)
  • public std::pair<iterator, bool> insert(std::pair<KeyT, ValueT> && KV)
  • public ValueT lookup(const KeyT & Key) const
  • public void pop_back()
  • public llvm::MapVector::reverse_iterator rbegin()
  • public llvm::MapVector::const_reverse_iterator rbegin() const
  • public template <class Predicate>void remove_if(Predicate Pred)
  • public llvm::MapVector::const_reverse_iterator rend() const
  • public llvm::MapVector::reverse_iterator rend()
  • public void reserve(llvm::MapVector::size_type NumEntries)
  • public llvm::MapVector::size_type size() const
  • public void swap(MapVector<KeyT, ValueT, MapType, VectorType> & RHS)
  • public VectorType takeVector()

Methods

const std::pair<KeyT, ValueT>& back() const

Declared at: llvm/include/llvm/ADT/MapVector.h:87

std::pair<KeyT, ValueT>& back()

Declared at: llvm/include/llvm/ADT/MapVector.h:86

llvm::MapVector::iterator begin()

Declared at: llvm/include/llvm/ADT/MapVector.h:70

llvm::MapVector::const_iterator begin() const

Declared at: llvm/include/llvm/ADT/MapVector.h:71

void clear()

Declared at: llvm/include/llvm/ADT/MapVector.h:89

llvm::MapVector::size_type count(
    const KeyT& Key) const

Declared at: llvm/include/llvm/ADT/MapVector.h:143

Parameters

const KeyT& Key

bool empty() const

Declared at: llvm/include/llvm/ADT/MapVector.h:80

llvm::MapVector::const_iterator end() const

Declared at: llvm/include/llvm/ADT/MapVector.h:73

llvm::MapVector::iterator end()

Declared at: llvm/include/llvm/ADT/MapVector.h:72

typename VectorType::iterator erase(
    typename VectorType::iterator Iterator)

Description

Remove the element given by Iterator. Returns an iterator to the element following the one which was removed, which may be end().

Declared at: llvm/include/llvm/ADT/MapVector.h:174

Parameters

typename VectorType::iterator Iterator

llvm::MapVector::size_type erase(const KeyT& Key)

Description

Remove all elements with the key value Key. Returns the number of elements removed.

Declared at: llvm/include/llvm/ADT/MapVector.h:193

Parameters

const KeyT& Key

llvm::MapVector::const_iterator find(
    const KeyT& Key) const

Declared at: llvm/include/llvm/ADT/MapVector.h:154

Parameters

const KeyT& Key

llvm::MapVector::iterator find(const KeyT& Key)

Declared at: llvm/include/llvm/ADT/MapVector.h:148

Parameters

const KeyT& Key

std::pair<KeyT, ValueT>& front()

Declared at: llvm/include/llvm/ADT/MapVector.h:84

const std::pair<KeyT, ValueT>& front() const

Declared at: llvm/include/llvm/ADT/MapVector.h:85

std::pair<iterator, bool> insert(
    const std::pair<KeyT, ValueT>& KV)

Declared at: llvm/include/llvm/ADT/MapVector.h:118

Parameters

const std::pair<KeyT, ValueT>& KV

std::pair<iterator, bool> insert(
    std::pair<KeyT, ValueT>&& KV)

Declared at: llvm/include/llvm/ADT/MapVector.h:130

Parameters

std::pair<KeyT, ValueT>&& KV

ValueT lookup(const KeyT& Key) const

Declared at: llvm/include/llvm/ADT/MapVector.h:111

Parameters

const KeyT& Key

void pop_back()

Description

Remove the last element from the vector.

Declared at: llvm/include/llvm/ADT/MapVector.h:161

llvm::MapVector::reverse_iterator rbegin()

Declared at: llvm/include/llvm/ADT/MapVector.h:75

llvm::MapVector::const_reverse_iterator rbegin()
    const

Declared at: llvm/include/llvm/ADT/MapVector.h:76

template <class Predicate>
void remove_if(Predicate Pred)

Description

Remove the elements that match the predicate. Erase all elements that match \c Pred in a single pass. Takes linear time.

Declared at: llvm/include/llvm/ADT/MapVector.h:205

Templates

Predicate

Parameters

Predicate Pred

llvm::MapVector::const_reverse_iterator rend()
    const

Declared at: llvm/include/llvm/ADT/MapVector.h:78

llvm::MapVector::reverse_iterator rend()

Declared at: llvm/include/llvm/ADT/MapVector.h:77

void reserve(
    llvm::MapVector::size_type NumEntries)

Description

Grow the MapVector so that it can contain at least \p NumEntries items before resizing again.

Declared at: llvm/include/llvm/ADT/MapVector.h:65

Parameters

llvm::MapVector::size_type NumEntries

llvm::MapVector::size_type size() const

Declared at: llvm/include/llvm/ADT/MapVector.h:61

void swap(
    MapVector<KeyT, ValueT, MapType, VectorType>&
        RHS)

Declared at: llvm/include/llvm/ADT/MapVector.h:94

Parameters

MapVector<KeyT, ValueT, MapType, VectorType>& RHS

VectorType takeVector()

Description

Clear the MapVector and return the underlying vector.

Declared at: llvm/include/llvm/ADT/MapVector.h:56