Sets are containers that store unique elements following a specific order.
In a set, the value of an element also identifies it (the value is itself the key, of type T), and each value must be unique. The value of the elements in a set cannot be modified once in the container (the elements are always const), but they can be inserted or removed from the container.
Internally, the elements in a set are always sorted following a specific strict weak ordering criterion indicated by its internal comparison object (of type Compare).
set containers are generally slower than unordered_set containers to access individual elements by their key, but they allow the direct iteration on subsets based on their order.
Sets are typically implemented as binary search trees.
成员函数:
- (constructor)
- Construct set (public member function )
- (destructor)
- Set destructor (public member function )
- operator=
- Copy container content (public member function )
Iterators:
- begin
- Return iterator to beginning (public member function )
- end
- Return iterator to end (public member function )
- rbegin
- Return reverse iterator to reverse beginning (public member function )
- rend
- Return reverse iterator to reverse end (public member function )
- cbegin
- Return const_iterator to beginning (public member function )
- cend
- Return const_iterator to end (public member function )
- crbegin
- Return const_reverse_iterator to reverse beginning (public member function )
- crend
- Return const_reverse_iterator to reverse end (public member function )
Capacity:
- empty
- Test whether container is empty (public member function )
- size
- Return container size (public member function )
- max_size
- Return maximum size (public member function )
Modifiers:
- insert
- Insert element (public member function )
- erase
- Erase elements (public member function )
- swap
- Swap content (public member function )
- clear
- Clear content (public member function )
- emplace
- Construct and insert element (public member function )
- emplace_hint
- Construct and insert element with hint (public member function )
Observers:
- key_comp
- Return comparison object (public member function )
- value_comp
- Return comparison object (public member function )
Operations:
- find
- Get iterator to element (public member function )
- count
- Count elements with a specific value (public member function )
- lower_bound
- Return iterator to lower bound (public member function )
- upper_bound
- Return iterator to upper bound (public member function )
- equal_range
- Get range of equal elements (public member function )
Allocator:
- get_allocator
- Get allocator (public member function )