A sorted_vector_map is similar to a sorted_vector_set but stores <key,value> pairs instead of single elements.

Synopsis

Declared in <folly/container/sorted_vector_types.h>

template<
    class Key,
    class Value,
    class Compare = std::less<Key>,
    class Allocator = std::allocator<std::pair<Key, Value>>,
    class GrowthPolicy = void,
    class Container = std::vector<std::pair<Key, Value>, Allocator>>
class sorted_vector_map;

Types

Name

Description

value_compare

Comparator that orders elements by their key.

Type Aliases

Name

Description

allocator_type

The allocator type of the underlying container.

const_iterator

Iterator over const elements.

const_pointer

Pointer to a const element.

const_reference

Reference to a const element.

const_reverse_iterator

Reverse iterator over const elements.

container_type

The underlying container type.

difference_type

Signed difference type between two iterators.

direct_mutation_guard

Guard type for direct mutation of the underlying container.

iterator

Iterator over elements.

key_compare

The comparator type used to order keys.

key_type

The key type of the map.

mapped_type

The mapped value type of the map.

pointer

Pointer to an element.

reference

Reference to an element.

reverse_iterator

Reverse iterator over elements.

size_type

Unsigned size type.

value_type

The element type stored in the container (a key/value pair).

Member Functions

Name

Description

sorted_vector_map [constructor]

Constructors

operator=

Assignment operators

at

Returns the value for key, or throws std::out_of_range if absent.

begin

begin overloads

capacity

Returns the number of elements the map can hold without reallocating.

cbegin

Returns a const iterator to the first element.

cend

Returns a const iterator past the last element.

clear

Removes all elements from the map.

contains

Returns true if the map contains key.

count

Returns the number of elements matching key (0 or 1).

crbegin

Returns a const reverse iterator to the last element.

crend

Returns a const reverse iterator before the first element.

data

Returns a pointer to the underlying contiguous storage.

emplace

emplace overloads

emplace_hint

emplace_hint overloads

empty

Returns true if the map has no elements.

end

end overloads

equal_range

Returns the range of elements matching key.

erase

erase overloads

find

find overloads

get_allocator

Returns the allocator associated with the underlying container.

get_container

Returns a const reference to the underlying container.

get_container_for_direct_mutation

Directly mutate the container.

insert

insert overloads

insert_or_assign

insert_or_assign overloads

key_comp

Returns the comparator used to order keys.

lower_bound

Returns an iterator to the first element not ordered before key.

max_size

Returns the maximum number of elements the map can hold.

operator[]

Returns a reference to the value for key, inserting a default if absent.

rbegin

rbegin overloads

rend

rend overloads

reserve

Reserves storage for at least s elements.

shrink_to_fit

Releases unused capacity back to the allocator.

size

Returns the number of elements.

swap

Swaps the contents of this map with another.

swap_container

swap_container overloads

try_emplace

Inserts a value constructed in place from args if key k is absent.

upper_bound

Returns an iterator to the first element ordered after key.

value_comp

Returns the comparator used to order elements.

operator==

Returns true if both maps hold equal elements in the same order.

operator!=

Returns true if the maps differ.

operator<

Compares two maps lexicographically.

operator<=

Compares two maps lexicographically.

operator>

Compares two maps lexicographically.

operator>=

Compares two maps lexicographically.

Friends

Name

Description

folly::operator<=>

Compares two maps lexicographically by three‐way comparison.

folly::erase_if

Erases every element for which predicate returns true; returns the count.

Non-Member Functions

Name

Description

swap

Swap function that can be found using ADL.

Template Parameters

Name

Description

Key

Key type

Value

Value type

Compare

Function that can compare key types and impose a strict weak ordering over them.

Allocator

allocation policy

GrowthPolicy

policy object to control growth

Created with MrDocs