C++ Sets
Syntax:
The begin() function returns an iterator to the first element of the current set.
Syntax:
The clear() function removes all of the elements from the current set.
Syntax:
size_type count( const key_type &key );
|
The function count() returns the number of occurances of key in the current set.
Syntax:
The empty() function returns true if the current set is empty, and false otherwise.
Syntax:
The end() function returns an iterator to the end of the current set.
Syntax:
pair equal_range( const key_type &key );
|
The function equal_range() finds the first and last locations of key in the current set, and
returns iterators to those locations.
Syntax:
The erase() function either:
- erases the element at location i,
- erases the elements from start to end, or
- erases all elements that have a value of key (returning the number of elements erased).
Syntax:
The find() function attempts to find an element of the current set that matches key, then returns
an iterator to that element. If no match is found, an iterator to the end of the set is returned.
Syntax:
allocator_type get_allocator();
|
The get_allocator() function returns the allocator for the current set.
Syntax:
The function insert() either:
- inserts val after the element at i,
- inserts a range of elements denoted by start and end, or
- inserts val into the current set, returning an iterator and a boolean value indicating whether
val was successfully inserted.
It should be noted that duplicate elements are not inserted into sets.
Syntax:
iterator lower_bound( const key_type &key );
|
The function lower_bound() returns an iterator to the first element in the current set with a key equal
to or greater than key.
Syntax:
The function key_comp() returns a function object that compares keys.
Syntax:
The max_size() function returns the maximum number of elements that the current set can hold.
Syntax:
The function rbegin() returns a reverse iterator to the end of the current set.
Syntax:
The rend() function returns a reverse iterator to the beginning of the current set.
Syntax:
The size() function returns the number of elements in the current set.
Syntax:
void swap( set &object );
|
The function swap() exchanges the elements stored in the current set with those in object.
Syntax:
iterator upper_bound( const key_type &key );
|
The upper_bound() function returns an iterator to the first element in the current set with a key greater
than key.
Syntax:
value_compare value_comp();
|
The value_comp() function returns a function object that compares values.