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 107 of file stl_set.h.
typedef _Key_alloc_type::pointer pointer |
set | ( | const _Compare & | __comp, | |
const allocator_type & | __a = allocator_type() | |||
) | [inline, explicit] |
set | ( | _InputIterator | __first, | |
_InputIterator | __last | |||
) | [inline] |
Builds a set from a range.
first | An input iterator. | |
last | An input iterator. |
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. |
iterator begin | ( | ) | const [inline] |
void clear | ( | ) | [inline] |
bool empty | ( | ) | const [inline] |
iterator end | ( | ) | const [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.
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. |
Erases elements according to the provided key.
x | Key of element to be erased. |
void erase | ( | iterator | __position | ) | [inline] |
Erases an element from a set.
position | An iterator pointing to the element to be erased. |
Tries to locate an element in a set.
x | Element to be located. |
end()
) iterator.
allocator_type get_allocator | ( | ) | const [inline] |
void insert | ( | _InputIterator | __first, | |
_InputIterator | __last | |||
) | [inline] |
iterator 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> insert | ( | const value_type & | __x | ) | [inline] |
Attempts to insert an element into the set.
x | Element to be inserted. |
Insertion requires logarithmic time.
Definition at line 318 of file stl_set.h.
References pair::first, and pair::second.
key_compare key_comp | ( | ) | const [inline] |
Returns the comparison object with which the set was constructed.
Definition at line 228 of file stl_set.h.
References _Rb_tree::key_comp().
Finds the beginning of a subsequence matching given key.
x | Key to be located. |
size_type max_size | ( | ) | const [inline] |
reverse_iterator rbegin | ( | ) | const [inline] |
reverse_iterator rend | ( | ) | const [inline] |
size_type size | ( | ) | const [inline] |
void 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.
Definition at line 300 of file stl_set.h.
References set::_M_t.
Referenced by std::swap().
value_compare value_comp | ( | ) | const [inline] |