absl::btree_map

An ordered associative container of unique keys and associated values.

Synopsis

Declared in <absl/container/btree_map.h>

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

NameDescription
/* implementation-defined */::btree_map_container</* implementation-defined */::btree</* implementation-defined */>>

Type Aliases

Name
allocator_type
const_iterator
iterator
key_compare
key_type
mapped_type
value_type

Member Functions

NameDescription
btree_map [constructor]Constructs an empty btree_map.
at
insert_or_assign
operator[] Subscript operators
try_emplace

Using Declarations

Name
Unnamed using
at
begin
cbegin
cend
clear
contains
count
emplace
emplace_hint
empty
end
equal_range
erase
extract
extract_and_get_next
find
get_allocator
insert
insert_or_assign
key_comp
lower_bound
max_size
merge
operator[]
size
swap
try_emplace
upper_bound
value_comp

Non-Member Functions

NameDescription
erase_ifErases all elements that satisfy the predicate pred from the container.
swapSwaps the contents of two absl::btree_map containers.