[#BloombergLP-bdlc-FlatHashMap] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::FlatHashMap :relfileprefix: ../../ :mrdocs: Unordered map of unique keys to mapped values with open‐addressed storage. == Synopsis Declared in `<bdlc_flathashmap.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY, class VALUE, class HASH = xref:BloombergLP/bslh/FibonacciBadHashWrapper.adoc[bslh::FibonacciBadHashWrapper<bsl::hash<KEY>>], class EQUAL = xref:bsl/equal_to-0d.adoc[bsl::equal_to<KEY>]> class FlatHashMap; ---- == Description This class template implements a value‐semantic container type holding an unordered map of `KEY‐VALUE` pairs having unique keys that provides a mapping from keys of (template parameter) type `KEY` to their associated mapped values of (template parameter) type `VALUE`. The (template parameter) type `HASH` is a functor providing the hash value for `KEY`. The (template parameter) type `EQUAL` is a functor providing the equality function for two `KEY` values. See {Requirements on `KEY`, `HASH`, and `EQUAL`} for more information. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/FlatHashMap/const_iterator.adoc[`const_iterator`] | Iterator over non‐modifiable elements. | xref:BloombergLP/bdlc/FlatHashMap/const_pointer.adoc[`const_pointer`] | Pointer to a non‐modifiable value. | xref:BloombergLP/bdlc/FlatHashMap/const_reference.adoc[`const_reference`] | Reference to a non‐modifiable value. | xref:BloombergLP/bdlc/FlatHashMap/difference_type.adoc[`difference_type`] | Signed type used for iterator distances. | xref:BloombergLP/bdlc/FlatHashMap/hasher.adoc[`hasher`] | Hash functor type. | xref:BloombergLP/bdlc/FlatHashMap/iterator.adoc[`iterator`] | Iterator over modifiable elements. | xref:BloombergLP/bdlc/FlatHashMap/key_compare.adoc[`key_compare`] | Key equality predicate type. | xref:BloombergLP/bdlc/FlatHashMap/key_type.adoc[`key_type`] | Key type of this map. | xref:BloombergLP/bdlc/FlatHashMap/mapped_type.adoc[`mapped_type`] | Mapped value type of this map. | xref:BloombergLP/bdlc/FlatHashMap/pointer.adoc[`pointer`] | Pointer to a modifiable value. | xref:BloombergLP/bdlc/FlatHashMap/reference.adoc[`reference`] | Reference to a modifiable value. | xref:BloombergLP/bdlc/FlatHashMap/size_type.adoc[`size_type`] | Unsigned type used for sizes and capacities. | xref:BloombergLP/bdlc/FlatHashMap/value_type.adoc[`value_type`] | Element type stored by this map (`const KEY`, `VALUE` pair). |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/FlatHashMap/2constructor-056.adoc[`FlatHashMap`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlc/FlatHashMap/2destructor.adoc[`~FlatHashMap`] [.small]#[destructor]# | Destroy this object and each of its elements. | xref:BloombergLP/bdlc/FlatHashMap/operator_assign-04.adoc[`operator=`] | Assignment operators | xref:BloombergLP/bdlc/FlatHashMap/allocator.adoc[`allocator`] | Return the allocator used by this flat hash map to supply memory. | xref:BloombergLP/bdlc/FlatHashMap/at-09.adoc[`at`] | `at` overloads | xref:BloombergLP/bdlc/FlatHashMap/begin-06.adoc[`begin`] | `begin` overloads | xref:BloombergLP/bdlc/FlatHashMap/capacity.adoc[`capacity`] | Return the number of elements this map could hold if the load factor were 1. | xref:BloombergLP/bdlc/FlatHashMap/cbegin.adoc[`cbegin`] | Return a `const_iterator` to the first element in the sequence of elements maintained by this map, or the `end` iterator if this map is empty. | xref:BloombergLP/bdlc/FlatHashMap/cend.adoc[`cend`] | Return a `const_iterator` to the past‐the‐end element in the sequence of elements maintained by this map. | xref:BloombergLP/bdlc/FlatHashMap/clear.adoc[`clear`] | Remove all elements from this map. | xref:BloombergLP/bdlc/FlatHashMap/contains-09.adoc[`contains`] | Return whether this map contains an element with `key`. | xref:BloombergLP/bdlc/FlatHashMap/count-0d.adoc[`count`] | Return the number of elements with the specified `key`. | xref:BloombergLP/bdlc/FlatHashMap/emplace.adoc[`emplace`] | Emplace a newly constructed element into this map. | xref:BloombergLP/bdlc/FlatHashMap/emplace_hint.adoc[`emplace_hint`] | Emplace a newly constructed element using a placement hint. | xref:BloombergLP/bdlc/FlatHashMap/empty.adoc[`empty`] | Return `true` if this map contains no elements, and `false` otherwise. | xref:BloombergLP/bdlc/FlatHashMap/end-03.adoc[`end`] | `end` overloads | xref:BloombergLP/bdlc/FlatHashMap/equal_range-02.adoc[`equal_range`] | `equal_range` overloads | xref:BloombergLP/bdlc/FlatHashMap/erase-04b.adoc[`erase`] | `erase` overloads | xref:BloombergLP/bdlc/FlatHashMap/find-04.adoc[`find`] | Return an iterator to the element with the specified `key`. | xref:BloombergLP/bdlc/FlatHashMap/hash_function.adoc[`hash_function`] | Return (a copy of) the unary hash functor used by this map to generate a hash value (of type `bsl::size_t`) for a `KEY` object. | xref:BloombergLP/bdlc/FlatHashMap/insert-08.adoc[`insert`] | `insert` overloads | xref:BloombergLP/bdlc/FlatHashMap/insert_or_assign-0f.adoc[`insert_or_assign`] | `insert_or_assign` overloads | xref:BloombergLP/bdlc/FlatHashMap/key_eq.adoc[`key_eq`] | Return (a copy of) the binary key‐equality functor that returns `true` if the value of two `KEY` objects are equivalent, and `false` otherwise. | xref:BloombergLP/bdlc/FlatHashMap/load_factor.adoc[`load_factor`] | Return the current ratio between the number of elements in this container and its capacity. | xref:BloombergLP/bdlc/FlatHashMap/max_load_factor.adoc[`max_load_factor`] | Return the maximum load factor allowed for this map. | xref:BloombergLP/bdlc/FlatHashMap/operator_subs-03.adoc[`operator[]`] | Return a modifiable reference to the mapped value for `key`. | xref:BloombergLP/bdlc/FlatHashMap/print.adoc[`print`] | Format this map to the specified output `stream`. | xref:BloombergLP/bdlc/FlatHashMap/rehash.adoc[`rehash`] | Rehash this map to at least the specified `minimumCapacity`. | xref:BloombergLP/bdlc/FlatHashMap/reserve.adoc[`reserve`] | Reserve capacity for at least the specified `numEntries`. | xref:BloombergLP/bdlc/FlatHashMap/reset.adoc[`reset`] | Remove all elements from this map and release all memory from this map, returning the map to the default constructed state. | xref:BloombergLP/bdlc/FlatHashMap/size.adoc[`size`] | Return the number of elements in this map. | xref:BloombergLP/bdlc/FlatHashMap/swap.adoc[`swap`] | Exchange the value of this map with that of `other`. | xref:BloombergLP/bdlc/FlatHashMap/try_emplace-03.adoc[`try_emplace`] | `try_emplace` overloads |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdlc/swap-05.adoc[BloombergLP::bdlc::swap]` | Exchange the contents of the two maps. | `xref:BloombergLP/bdlc/operator_not_eq-06.adoc[BloombergLP::bdlc::operator!=]` | Return whether the maps differ in key/value contents. | `xref:BloombergLP/bdlc/operator_eq-04c.adoc[BloombergLP::bdlc::operator==]` | Return whether the maps have the same key/value contents. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/operator_not_eq-0b1.adoc[`operator!=`] | Return whether `lhs` and `rhs` do not have the same value. | xref:BloombergLP/bdlc/operator_eq-0d9.adoc[`operator==`] | Return whether `lhs` and `rhs` have the same value. | xref:BloombergLP/bdlc/swap-061.adoc[`swap`] | Exchange the value of `a` with that of `b`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#