WPILibC++ 2024.3.2
wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT > Class Template Reference

#include </home/runner/work/allwpilib/allwpilib/wpiutil/src/main/native/thirdparty/llvm/include/wpi/DenseMap.h>

Inheritance diagram for wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >:
wpi::DebugEpochBase

Public Types

using size_type = unsigned
 
using key_type = KeyT
 
using mapped_type = ValueT
 
using value_type = BucketT
 
using iterator = DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT >
 
using const_iterator = DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT, true >
 

Public Member Functions

iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
bool empty () const
 
unsigned size () const
 
void reserve (size_type NumEntries)
 Grow the densemap so that it can contain at least NumEntries items before resizing again. More...
 
void clear ()
 
bool contains (const_arg_type_t< KeyT > Val) const
 Return true if the specified key is in the map, false otherwise. More...
 
size_type count (const_arg_type_t< KeyT > Val) const
 Return 1 if the specified key is in the map, 0 otherwise. More...
 
iterator find (const_arg_type_t< KeyT > Val)
 
const_iterator find (const_arg_type_t< KeyT > Val) const
 
template<class LookupKeyT >
iterator find_as (const LookupKeyT &Val)
 Alternate version of find() which allows a different, and possibly less expensive, key type. More...
 
template<class LookupKeyT >
const_iterator find_as (const LookupKeyT &Val) const
 
ValueT lookup (const_arg_type_t< KeyT > Val) const
 lookup - Return the entry for the specified key, or a default constructed value if no such entry exists. More...
 
const ValueT & at (const_arg_type_t< KeyT > Val) const
 at - Return the entry for the specified key, or abort if no such entry exists. More...
 
std::pair< iterator, bool > insert (const std::pair< KeyT, ValueT > &KV)
 
std::pair< iterator, bool > insert (std::pair< KeyT, ValueT > &&KV)
 
template<typename... Ts>
std::pair< iterator, bool > try_emplace (KeyT &&Key, Ts &&... Args)
 
template<typename... Ts>
std::pair< iterator, bool > try_emplace (const KeyT &Key, Ts &&... Args)
 
template<typename LookupKeyT >
std::pair< iterator, bool > insert_as (std::pair< KeyT, ValueT > &&KV, const LookupKeyT &Val)
 Alternate version of insert() which allows a different, and possibly less expensive, key type. More...
 
template<typename InputIt >
void insert (InputIt I, InputIt E)
 insert - Range insertion of pairs. More...
 
ValueT & getOrInsertDefault (KeyT &&Key)
 Returns the value associated to the key in the map if it exists. More...
 
ValueT & getOrInsertDefault (const KeyT &Key)
 Returns the value associated to the key in the map if it exists. More...
 
bool erase (const KeyT &Val)
 
void erase (iterator I)
 
value_typeFindAndConstruct (const KeyT &Key)
 
ValueT & operator[] (const KeyT &Key)
 
value_typeFindAndConstruct (KeyT &&Key)
 
ValueT & operator[] (KeyT &&Key)
 
bool isPointerIntoBucketsArray (const void *Ptr) const
 isPointerIntoBucketsArray - Return true if the specified pointer points somewhere into the DenseMap's array of buckets (i.e. More...
 
const void * getPointerIntoBucketsArray () const
 getPointerIntoBucketsArray() - Return an opaque pointer into the buckets array. More...
 
size_t getMemorySize () const
 Return the approximate size (in bytes) of the actual map. More...
 
- Public Member Functions inherited from wpi::DebugEpochBase
 DebugEpochBase ()=default
 
void incrementEpoch ()
 Calling incrementEpoch invalidates all handles pointing into the calling instance. More...
 
 ~DebugEpochBase ()
 The destructor calls incrementEpoch to make use-after-free bugs more likely to crash deterministically. More...
 

Protected Member Functions

 DenseMapBase ()=default
 
void destroyAll ()
 
void initEmpty ()
 
unsigned getMinBucketToReserveForEntries (unsigned NumEntries)
 Returns the number of buckets to allocate to ensure that the DenseMap can accommodate NumEntries without need to grow(). More...
 
void moveFromOldBuckets (BucketT *OldBucketsBegin, BucketT *OldBucketsEnd)
 
template<typename OtherBaseT >
void copyFrom (const DenseMapBase< OtherBaseT, KeyT, ValueT, KeyInfoT, BucketT > &other)
 

Static Protected Member Functions

static unsigned getHashValue (const KeyT &Val)
 
template<typename LookupKeyT >
static unsigned getHashValue (const LookupKeyT &Val)
 
static const KeyT getEmptyKey ()
 
static const KeyT getTombstoneKey ()
 

Member Typedef Documentation

◆ const_iterator

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
using wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::const_iterator = DenseMapIterator<KeyT, ValueT, KeyInfoT, BucketT, true>

◆ iterator

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
using wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::iterator = DenseMapIterator<KeyT, ValueT, KeyInfoT, BucketT>

◆ key_type

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
using wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::key_type = KeyT

◆ mapped_type

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
using wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::mapped_type = ValueT

◆ size_type

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
using wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size_type = unsigned

◆ value_type

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
using wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::value_type = BucketT

Constructor & Destructor Documentation

◆ DenseMapBase()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::DenseMapBase ( )
protecteddefault

Member Function Documentation

◆ at()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
const ValueT & wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::at ( const_arg_type_t< KeyT >  Val) const
inline

at - Return the entry for the specified key, or abort if no such entry exists.

◆ begin() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
iterator wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::begin ( )
inline

◆ begin() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
const_iterator wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::begin ( ) const
inline

◆ clear()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
void wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear ( )
inline

◆ contains()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
bool wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::contains ( const_arg_type_t< KeyT >  Val) const
inline

Return true if the specified key is in the map, false otherwise.

◆ copyFrom()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
template<typename OtherBaseT >
void wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::copyFrom ( const DenseMapBase< OtherBaseT, KeyT, ValueT, KeyInfoT, BucketT > &  other)
inlineprotected

◆ count()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
size_type wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count ( const_arg_type_t< KeyT >  Val) const
inline

Return 1 if the specified key is in the map, 0 otherwise.

◆ destroyAll()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
void wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::destroyAll ( )
inlineprotected

◆ empty()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
bool wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty ( ) const
inline

◆ end() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
iterator wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end ( )
inline

◆ end() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
const_iterator wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end ( ) const
inline

◆ erase() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
bool wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase ( const KeyT &  Val)
inline

◆ erase() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
void wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase ( iterator  I)
inline

◆ find() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
iterator wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find ( const_arg_type_t< KeyT >  Val)
inline

◆ find() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
const_iterator wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find ( const_arg_type_t< KeyT >  Val) const
inline

◆ find_as() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
template<class LookupKeyT >
iterator wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find_as ( const LookupKeyT &  Val)
inline

Alternate version of find() which allows a different, and possibly less expensive, key type.

The DenseMapInfo is responsible for supplying methods getHashValue(LookupKeyT) and isEqual(LookupKeyT, KeyT) for each key type used.

◆ find_as() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
template<class LookupKeyT >
const_iterator wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find_as ( const LookupKeyT &  Val) const
inline

◆ FindAndConstruct() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
value_type & wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::FindAndConstruct ( const KeyT &  Key)
inline

◆ FindAndConstruct() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
value_type & wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::FindAndConstruct ( KeyT &&  Key)
inline

◆ getEmptyKey()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
static const KeyT wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::getEmptyKey ( )
inlinestaticprotected

◆ getHashValue() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
static unsigned wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::getHashValue ( const KeyT &  Val)
inlinestaticprotected

◆ getHashValue() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
template<typename LookupKeyT >
static unsigned wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::getHashValue ( const LookupKeyT &  Val)
inlinestaticprotected

◆ getMemorySize()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
size_t wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::getMemorySize ( ) const
inline

Return the approximate size (in bytes) of the actual map.

This is just the raw memory used by DenseMap. If entries are pointers to objects, the size of the referenced objects are not included.

◆ getMinBucketToReserveForEntries()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
unsigned wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::getMinBucketToReserveForEntries ( unsigned  NumEntries)
inlineprotected

Returns the number of buckets to allocate to ensure that the DenseMap can accommodate NumEntries without need to grow().

◆ getOrInsertDefault() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
ValueT & wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::getOrInsertDefault ( const KeyT &  Key)
inline

Returns the value associated to the key in the map if it exists.

If it does not exist, emplace a default value for the key and returns a reference to the newly created value.

◆ getOrInsertDefault() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
ValueT & wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::getOrInsertDefault ( KeyT &&  Key)
inline

Returns the value associated to the key in the map if it exists.

If it does not exist, emplace a default value for the key and returns a reference to the newly created value.

◆ getPointerIntoBucketsArray()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
const void * wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::getPointerIntoBucketsArray ( ) const
inline

getPointerIntoBucketsArray() - Return an opaque pointer into the buckets array.

In conjunction with the previous method, this can be used to determine whether an insertion caused the DenseMap to reallocate.

◆ getTombstoneKey()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
static const KeyT wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::getTombstoneKey ( )
inlinestaticprotected

◆ initEmpty()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
void wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::initEmpty ( )
inlineprotected

◆ insert() [1/3]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
std::pair< iterator, bool > wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert ( const std::pair< KeyT, ValueT > &  KV)
inline

◆ insert() [2/3]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
template<typename InputIt >
void wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert ( InputIt  I,
InputIt  E 
)
inline

insert - Range insertion of pairs.

◆ insert() [3/3]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
std::pair< iterator, bool > wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert ( std::pair< KeyT, ValueT > &&  KV)
inline

◆ insert_as()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
template<typename LookupKeyT >
std::pair< iterator, bool > wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert_as ( std::pair< KeyT, ValueT > &&  KV,
const LookupKeyT &  Val 
)
inline

Alternate version of insert() which allows a different, and possibly less expensive, key type.

The DenseMapInfo is responsible for supplying methods getHashValue(LookupKeyT) and isEqual(LookupKeyT, KeyT) for each key type used.

◆ isPointerIntoBucketsArray()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
bool wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::isPointerIntoBucketsArray ( const void *  Ptr) const
inline

isPointerIntoBucketsArray - Return true if the specified pointer points somewhere into the DenseMap's array of buckets (i.e.

either to a key or value in the DenseMap).

◆ lookup()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
ValueT wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::lookup ( const_arg_type_t< KeyT >  Val) const
inline

lookup - Return the entry for the specified key, or a default constructed value if no such entry exists.

◆ moveFromOldBuckets()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
void wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::moveFromOldBuckets ( BucketT *  OldBucketsBegin,
BucketT *  OldBucketsEnd 
)
inlineprotected

◆ operator[]() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
ValueT & wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::operator[] ( const KeyT &  Key)
inline

◆ operator[]() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
ValueT & wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::operator[] ( KeyT &&  Key)
inline

◆ reserve()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
void wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::reserve ( size_type  NumEntries)
inline

Grow the densemap so that it can contain at least NumEntries items before resizing again.

◆ size()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
unsigned wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size ( ) const
inline

◆ try_emplace() [1/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
template<typename... Ts>
std::pair< iterator, bool > wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace ( const KeyT &  Key,
Ts &&...  Args 
)
inline

◆ try_emplace() [2/2]

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
template<typename... Ts>
std::pair< iterator, bool > wpi::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace ( KeyT &&  Key,
Ts &&...  Args 
)
inline

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