Use the set of C ++

1) the value of each element in the set are unique, but the system can be automatically sorted according to the value of the element. values in the set of elements can not be directly changed
  two features set included:
  1. set the elements are sorted
  2. set elements are unique, not repeated

2) Statement: Example: set <int> s;

3) commonly used method of set (S ~).
  The begin (); // return a pointer to the first element of the iterator
  end (); // return a pointer to the last element iterator
  clear (); // clears all elements
  count (); // returns the number of elements in a value
  empty (); // if the set is empty, return to true
  equal_range (); // returns two iterators with a given set of upper and lower value equal to
  erase () - delete the collection element
  find () - returns a pointer to the iterator found among elements
  get_allocator () - returns a set of dispenser
  iNSERT () - is inserted within the collection
  lower_bound () - returns a pointer is greater than (or equal to ) of the first element iterator certain value
  key_comp () - returns a function value comparison between elements for
  max_size () - returns the set of elements can accommodate a maximum limit of
  the last element in the collection to return - rbegin () reverse iterator
  rend () - returns a pointer to the first element of the set reverse iterator
  size () - number of elements in the set of
  swap () - two sets of variables exchange
  upper_bound () - returns a value greater than the element iterator
  value_comp () - returns a comparison between the elements The function values

Guess you like

Origin www.cnblogs.com/gcw0618/p/12088517.html