Unordered associative container mapping unique keys to values.

Synopsis

Declared in <bslstl_unorderedmap.h>

template<
    class KEY,
    class VALUE,
    class HASH = bsl::hash<KEY>,
    class EQUAL = bsl::equal_to<KEY>,
    class ALLOCATOR = bsl::allocator<bsl::pair<KEY const, VALUE>>>
class unordered_map;

Description

This class template implements a value‐semantic container type holding an unordered set of KEY‐VALUE pairs having unique keys that provide a mapping from keys (of template parameter type KEY) to their associated mapped values (of template parameter type VALUE).

This class: * supports a complete set of value‐semantic operations * is exception‐neutral (agnostic except for the at method) * is alias‐safe * is const thread‐safe For terminology see {`bsldoc_glossary`}.

Type Aliases

Name

Description

allocator_type

This typedef is an alias to the (template parameter) ALLOCATOR.

const_iterator

This typedef is an alias to HashTableIterator<const value_type>.

const_local_iterator

This typedef is an alias to HashTableBucketIterator<const value_type>.

const_pointer

This typedef is an alias to AllocatorTraits::const_pointer.

const_reference

This typedef is an alias to const value_type&.

difference_type

This typedef is an alias to AllocatorTraits::difference_type.

hasher

This typedef is an alias to the (template parameter) HASH.

iterator

This typedef is an alias to HashTableIterator<value_type>.

key_equal

This typedef is an alias to the (template parameter) EQUAL.

key_type

This typedef is an alias to the (template parameter) KEY.

local_iterator

This typedef is an alias to HashTableBucketIterator<value_type>.

mapped_type

This typedef is an alias to the (template parameter) VALUE.

pointer

This typedef is an alias to AllocatorTraits::pointer.

reference

This typedef is an alias to value_type&.

size_type

This typedef is an alias to AllocatorTraits::size_type.

value_type

This typedef is an alias to bsl::pair<const KEY, VALUE>.

Member Functions

Name

Description

unordered_map [constructor]

Constructors

~unordered_map [destructor]

Destroy this object and each of its elements.

operator=

Assignment operators

at

at overloads

begin

begin overloads

bucket

bucket overloads

bucket_count

Return the number of buckets in the array of buckets maintained by this unordered map.

bucket_size

Return the number of elements in the bucket at index.

cbegin

cbegin overloads

cend

cend overloads

clear

Remove all entries from this unordered map.

contains

contains overloads

count

count overloads

emplace

Emplace a newly constructed element if its key is not already present.

emplace_hint

Emplace a newly constructed element at hint if its key is missing.

empty

Return true if this unordered map contains no elements, and false otherwise.

end

end overloads

equal_range

equal_range overloads

erase

erase overloads

find

find overloads

get_allocator

Return (a copy of) the allocator used for memory allocation by this unordered map.

hash_function

Return (a copy of) the unary hash functor used by this unordered map to generate a hash value (of type size_type) for a key_type object.

insert

insert overloads

insert_or_assign

insert_or_assign overloads

insert_range

Insert each element of range whose key is not already present.

key_eq

Return (a copy of) binary the key‐equality functor used by this unordered map that returns true if two key_type objects are equivalent, and false otherwise.

load_factor

Return the current load factor of this unordered map.

max_bucket_count

Return a theoretical upper bound on the number of buckets.

max_load_factor

max_load_factor overloads

max_size

Return a theoretical upper bound on the size of this unordered map.

operator[]

Subscript operators

rehash

Rehash this unordered map to at least numBuckets buckets.

reserve

Reserve capacity for at least numElements without rehashing.

size

Return the number of elements in this unordered map.

swap

Exchange the contents of this object with those of other.

try_emplace

try_emplace overloads

Deduction Guides

Name

Description

unordered_map<KEY, VALUE>

CTAD guide: deduce KEY and VALUE from initializer_list value_type.

unordered_map<KEY, VALUE>

CTAD guide: deduce KEY and VALUE from initializer_list value_type.

unordered_map<KEY, VALUE>

CTAD guide: deduce KEY and VALUE from iterator value_type.

unordered_map<KEY, VALUE>

CTAD guide: deduce KEY and VALUE from iterator value_type.

unordered_map<KEY, VALUE, HASH>

CTAD guide: deduce KEY and VALUE from initializer_list value_type.

unordered_map<KEY, VALUE, HASH>

CTAD guide: deduce KEY and VALUE from iterator value_type.

unordered_map<KEY, VALUE, HASH, EQUAL>

CTAD guide: deduce KEY and VALUE from initializer_list value_type.

unordered_map<KEY, VALUE, HASH, EQUAL>

CTAD guide: deduce KEY and VALUE from iterator value_type.

unordered_map<KEY, VALUE, HASH, EQUAL, ALLOCATOR>

CTAD guide: deduce KEY and VALUE from initializer_list value_type.

unordered_map<KEY, VALUE, HASH, EQUAL, ALLOCATOR>

CTAD guide: deduce KEY and VALUE from iterator value_type.

unordered_map<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY and VALUE from initializer_list value_type.

unordered_map<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY and VALUE from iterator value_type.

unordered_map<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY and VALUE from initializer_list value_type.

unordered_map<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY and VALUE from initializer_list value_type.

unordered_map<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY and VALUE from iterator value_type.

unordered_map<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY and VALUE from iterator value_type.

Friends

Name

Description

bsl::operator==

Return true if lhs and rhs have the same value, and false otherwise.

Non-Member Functions

Name

Description

erase_if

Erase every element of m that satisfies predicate.

operator==

Return true if lhs and rhs have the same value, and false otherwise.

swap

Exchange the contents of a with those of b.

Created with MrDocs