folly::sorted_vector_set

A sorted_vector_set is a container similar to std::set<>, but implemented as a sorted array with std::vector<>.

Synopsis

Declared in <folly/container/sorted_vector_types.h>

template<
    class T,
    class Compare = std::less<T>,
    class Allocator = std::allocator<T>,
    class GrowthPolicy = void,
    class Container = std::vector<T, Allocator>>
class sorted_vector_set;

Type Aliases

NameDescription
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 set (same as the element type).
pointer Pointer to an element.
reference Reference to an element.
reverse_iterator Reverse iterator over elements.
size_type Unsigned size type.
value_compare The comparator type used to order elements.
value_type The element type stored in the set.

Member Functions

NameDescription
sorted_vector_set [constructor]Constructors
operator= Assignment operators
begin begin overloads
capacity Returns the number of elements the set 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 set.
contains Returns true if the set contains key.
count Returns the number of elements matching key (0 or 1).
data Returns a pointer to the underlying contiguous storage.
emplace emplace overloads
emplace_hint emplace_hint overloads
empty Returns true if the set 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
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 set can hold.
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 set with another.
swap_container swap_container overloads
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 sets hold equal elements in the same order.
operator!= Returns true if the sets differ.
operator< Compares two sets lexicographically.
operator<= Compares two sets lexicographically.
operator> Compares two sets lexicographically.
operator>= Compares two sets lexicographically.

Friends

NameDescription
folly::operator<=>Compares two sets lexicographically by three-way comparison.
folly::erase_ifErases every element for which predicate returns true; returns the count.

Non-Member Functions

NameDescription
swapSwap function that can be found using ADL.

Template Parameters

NameDescription
TData type to store
CompareComparison function that imposes a strict weak ordering over instances of T
Allocatorallocation policy
GrowthPolicypolicy object to control growth