[#absl-btree_map] = xref:absl.adoc[absl]::btree_map :relfileprefix: ../ :mrdocs: An ordered associative container of unique keys and associated values. == Synopsis Declared in `<absl/container/btree_map.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename Key, typename Value, typename Compare = std::less<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>> class btree_map : public /* implementation-defined */::btree_map_container</* implementation-defined */::btree</* implementation-defined */>> ---- == Description An `absl::btree_map<K, V>` is an ordered associative container of unique keys and associated values designed to be a more efficient replacement for `std::map` (in most cases). Keys are sorted using an (optional) comparison function, which defaults to `std::less<K>`. An `absl::btree_map<K, V>` uses a default allocator of `std::allocator<std::pair<const K, V>>` to allocate (and deallocate) nodes, and construct and destruct values within those nodes. You may instead specify a custom allocator `A` (which in turn requires specifying a custom comparator `C`) as in `absl::btree_map<K, V, C, A>`. == Base Classes [cols="1,4"] |=== | Name| Description | `/* implementation-defined */::btree_map_container</* implementation-defined */::btree</* implementation-defined */>>` | |=== == Type Aliases [cols="1"] |=== | Name | xref:absl/btree_map/allocator_type.adoc[`allocator_type`] | xref:absl/btree_map/const_iterator.adoc[`const_iterator`] | xref:absl/btree_map/iterator.adoc[`iterator`] | xref:absl/btree_map/key_compare.adoc[`key_compare`] | xref:absl/btree_map/key_type.adoc[`key_type`] | xref:absl/btree_map/mapped_type.adoc[`mapped_type`] | xref:absl/btree_map/value_type.adoc[`value_type`] |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/btree_map/2constructor.adoc[`btree_map`] [.small]#[constructor]# | Constructs an empty `btree_map`. | xref:absl/btree_map/at-06.adoc[`at`] | | xref:absl/btree_map/insert_or_assign-02a.adoc[`insert_or_assign`] | | xref:absl/btree_map/operator_subs-01.adoc[`operator[]`] | Subscript operators | xref:absl/btree_map/try_emplace-0da.adoc[`try_emplace`] | |=== == Using Declarations [cols="1"] |=== | Name | xref:absl/btree_map/_10using.adoc[`Unnamed using`] | xref:absl/btree_map/at-0d.adoc[`at`] | xref:absl/btree_map/begin.adoc[`begin`] | xref:absl/btree_map/cbegin.adoc[`cbegin`] | xref:absl/btree_map/cend.adoc[`cend`] | xref:absl/btree_map/clear.adoc[`clear`] | xref:absl/btree_map/contains.adoc[`contains`] | xref:absl/btree_map/count.adoc[`count`] | xref:absl/btree_map/emplace.adoc[`emplace`] | xref:absl/btree_map/emplace_hint.adoc[`emplace_hint`] | xref:absl/btree_map/empty.adoc[`empty`] | xref:absl/btree_map/end.adoc[`end`] | xref:absl/btree_map/equal_range.adoc[`equal_range`] | xref:absl/btree_map/erase.adoc[`erase`] | xref:absl/btree_map/extract.adoc[`extract`] | xref:absl/btree_map/extract_and_get_next.adoc[`extract_and_get_next`] | xref:absl/btree_map/find.adoc[`find`] | xref:absl/btree_map/get_allocator.adoc[`get_allocator`] | xref:absl/btree_map/insert.adoc[`insert`] | xref:absl/btree_map/insert_or_assign-065a.adoc[`insert_or_assign`] | xref:absl/btree_map/key_comp.adoc[`key_comp`] | xref:absl/btree_map/lower_bound.adoc[`lower_bound`] | xref:absl/btree_map/max_size.adoc[`max_size`] | xref:absl/btree_map/merge.adoc[`merge`] | xref:absl/btree_map/operator[].adoc[`operator[]`] | xref:absl/btree_map/size.adoc[`size`] | xref:absl/btree_map/swap.adoc[`swap`] | xref:absl/btree_map/try_emplace-0b.adoc[`try_emplace`] | xref:absl/btree_map/upper_bound.adoc[`upper_bound`] | xref:absl/btree_map/value_comp.adoc[`value_comp`] |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/erase_if-089.adoc[`erase_if`] | Erases all elements that satisfy the predicate `pred` from the container. | xref:absl/swap-04.adoc[`swap`] | Swaps the contents of two `absl::btree_map` containers. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#