Sets support bidirectional iterators.
Key | Type of key objects. | |
Compare | Comparison function object type, defaults to less<Key>. | |
Alloc | Allocator type, defaults to allocator<Key>. |
Definition at line 93 of file stl_set.h.
typedef _Key std::set< _Key, _Compare, _Alloc >::key_type |
typedef _Key_alloc_type::pointer std::set< _Key, _Compare, _Alloc >::pointer |
std::set< _Key, _Compare, _Alloc >::set | ( | const _Compare & | __comp, | |
const allocator_type & | __a = allocator_type() | |||
) | [inline, explicit] |
Default constructor creates no elements.
comp | Comparator to use. | |
a | Allocator to use. |
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
std::set< _Key, _Compare, _Alloc >::set | ( | _InputIterator | __first, | |
_InputIterator | __last | |||
) | [inline] |
Builds a set from a range.
first | An input iterator. | |
last | An input iterator. |
std::set< _Key, _Compare, _Alloc >::set | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
const _Compare & | __comp, | |||
const allocator_type & | __a = allocator_type() | |||
) | [inline] |
Builds a set from a range.
first | An input iterator. | |
last | An input iterator. | |
comp | A comparison functor. | |
a | An allocator object. |
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
std::set< _Key, _Compare, _Alloc >::set | ( | const set< _Key, _Compare, _Alloc > & | __x | ) | [inline] |
Set copy constructor.
x | A set of identical element and allocator types. |
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >, and std::__debug::set< _Key, _Compare, _Allocator >.
iterator std::set< _Key, _Compare, _Alloc >::begin | ( | ) | const [inline] |
Returns a read/write iterator that points to the first element in the set. Iteration is done in ascending order according to the keys.
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
void std::set< _Key, _Compare, _Alloc >::clear | ( | ) | [inline] |
Erases all elements in a set. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibilty.
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
bool std::set< _Key, _Compare, _Alloc >::empty | ( | ) | const [inline] |
iterator std::set< _Key, _Compare, _Alloc >::end | ( | ) | const [inline] |
Returns a read/write iterator that points one past the last element in the set. Iteration is done in ascending order according to the keys.
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
std::pair<iterator, iterator> std::set< _Key, _Compare, _Alloc >::equal_range | ( | const key_type & | __x | ) | [inline] |
Finds a subsequence matching given key.
x | Key to be located. |
std::make_pair(c.lower_bound(val), c.upper_bound(val))
This function probably only makes sense for multisets.
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
void std::set< _Key, _Compare, _Alloc >::erase | ( | iterator | __first, | |
iterator | __last | |||
) | [inline] |
Erases a [first,last) range of elements from a set.
first | Iterator pointing to the start of the range to be erased. | |
last | Iterator pointing to the end of the range to be erased. |
size_type std::set< _Key, _Compare, _Alloc >::erase | ( | const key_type & | __x | ) | [inline] |
Erases elements according to the provided key.
x | Key of element to be erased. |
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
void std::set< _Key, _Compare, _Alloc >::erase | ( | iterator | __position | ) | [inline] |
Erases an element from a set.
position | An iterator pointing to the element to be erased. |
iterator std::set< _Key, _Compare, _Alloc >::find | ( | const key_type & | __x | ) | [inline] |
Tries to locate an element in a set.
x | Element to be located. |
end()
) iterator.
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
allocator_type std::set< _Key, _Compare, _Alloc >::get_allocator | ( | ) | const [inline] |
void std::set< _Key, _Compare, _Alloc >::insert | ( | _InputIterator | __first, | |
_InputIterator | __last | |||
) | [inline] |
A template function that attemps to insert a range of elements.
first | Iterator pointing to the start of the range to be inserted. | |
last | Iterator pointing to the end of the range. |
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
iterator std::set< _Key, _Compare, _Alloc >::insert | ( | iterator | __position, | |
const value_type & | __x | |||
) | [inline] |
Attempts to insert an element into the set.
position | An iterator that serves as a hint as to where the element should be inserted. | |
x | Element to be inserted. |
See http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4 for more on "hinting".
Insertion requires logarithmic time (if the hint is not taken).
std::pair<iterator,bool> std::set< _Key, _Compare, _Alloc >::insert | ( | const value_type & | __x | ) | [inline] |
Attempts to insert an element into the set.
x | Element to be inserted. |
Insertion requires logarithmic time.
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
key_compare std::set< _Key, _Compare, _Alloc >::key_comp | ( | ) | const [inline] |
iterator std::set< _Key, _Compare, _Alloc >::lower_bound | ( | const key_type & | __x | ) | [inline] |
Finds the beginning of a subsequence matching given key.
x | Key to be located. |
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
set<_Key,_Compare,_Alloc>& std::set< _Key, _Compare, _Alloc >::operator= | ( | const set< _Key, _Compare, _Alloc > & | __x | ) | [inline] |
Set assignment operator.
x | A set of identical element and allocator types. |
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
reverse_iterator std::set< _Key, _Compare, _Alloc >::rbegin | ( | ) | const [inline] |
Returns a read/write reverse iterator that points to the last element in the set. Iteration is done in descending order according to the keys.
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
reverse_iterator std::set< _Key, _Compare, _Alloc >::rend | ( | ) | const [inline] |
Returns a read-only (constant) reverse iterator that points to the last pair in the map. Iteration is done in descending order according to the keys.
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
void std::set< _Key, _Compare, _Alloc >::swap | ( | set< _Key, _Compare, _Alloc > & | __x | ) | [inline] |
Swaps data with another set.
x | A set of the same element and allocator types. |
Compare
type (which itself is often stateless and empty), so it should be quite fast.) Note that the global std::swap() function is specialized such that std::swap(s1,s2) will feed to this function.
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
Definition at line 286 of file stl_set.h.
Referenced by std::swap().
iterator std::set< _Key, _Compare, _Alloc >::upper_bound | ( | const key_type & | __x | ) | [inline] |
Finds the end of a subsequence matching given key.
x | Key to be located. |
Reimplemented in std::__debug::set< _Key, _Compare, _Allocator >.
value_compare std::set< _Key, _Compare, _Alloc >::value_comp | ( | ) | const [inline] |