cppreference.com -> C++ Sets -> Details

C++ Sets


begin

Syntax:

  iterator begin();

The begin() function returns an iterator to the first element of the current set.


clear

Syntax:

  void clear();

The clear() function removes all of the elements from the current set.


count

Syntax:

  size_type count( const key_type &key );

The function count() returns the number of occurances of key in the current set.


empty

Syntax:

  bool empty();

The empty() function returns true if the current set is empty, and false otherwise.


end

Syntax:

  const_iterator end();

The end() function returns an iterator to the end of the current set.


equal_range

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.


erase

Syntax:

  void erase( iterator i );
  void erase( iterator start, iterator end );
  size_type erase( const key_type &key );

The erase() function either:


find

Syntax:

  iterator find( const key_type &key );

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.


get_allocator

Syntax:

  allocator_type get_allocator();

The get_allocator() function returns the allocator for the current set.


insert

Syntax:

  iterator insert( iterator i, const TYPE &val );
  void insert( input_iterator start, input_iterator end );
  pair insert( const TYPE &val );

The function insert() either:

It should be noted that duplicate elements are not inserted into sets.


lower_bound

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.


key_comp

Syntax:

  key_compare key_comp();

The function key_comp() returns a function object that compares keys.


max_size

Syntax:

  size_type max_size();

The max_size() function returns the maximum number of elements that the current set can hold.


rbegin

Syntax:

  reverse_iterator rbegin();

The function rbegin() returns a reverse iterator to the end of the current set.


rend

Syntax:

  reverse_iterator rend();

The rend() function returns a reverse iterator to the beginning of the current set.


size

Syntax:

  size_type size();

The size() function returns the number of elements in the current set.


swap

Syntax:

  void swap( set &object );

The function swap() exchanges the elements stored in the current set with those in object.


upper_bound

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.


value_comp

Syntax:

  value_compare value_comp();

The value_comp() function returns a function object that compares values.