O'Reilly logo

C++ In a Nutshell by Ray Lischner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

set class template — Set container with unique keys

Synopsis

template <typename Key, typename Compare = less<Key>,
          typename Alloc = allocator<Key> >
class set {
public:
  typedef Key key_type;
  typedef Key value_type;
  typedef Compare key_compare;
  typedef Compare value_compare;
  typedef Alloc allocator_type;
  typedef typename Alloc::reference reference;
  typedef typename Alloc::const_reference const_reference;
  typedef  . . .  iterator;
  typedef  . . .  const_iterator;
  typedef  . . .  size_type;
  typedef  . . .  difference_type;
  typedef typename Alloc::pointer pointer;
  typedef typename Alloc::const_pointer const_pointer;
  typedef std::reverse_iterator<iterator> reverse_iterator;
  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
   
  explicit set(const Compare& comp = Compare(  ),
               const Alloc& = Alloc(  ));
  template <class InputIterator>
  set(InputIterator first, InputIterator last, 
      const Compare& comp = Compare(  ), const Alloc& = Alloc(  ));
  set(const set<Key,Compare,Alloc>& x);
  ~set(  );
  set<Key,Compare,Alloc>& operator=(const set<Key,Compare,Alloc>& x);
   
  allocator_type get_allocator(  ) const;
   
  iterator begin(  );
  const_iterator begin(  ) const;
  iterator end(  );
  const_iterator end(  ) const;
  reverse_iterator rbegin(  );
  const_reverse_iterator rbegin(  ) const;
  reverse_iterator rend(  );
  const_reverse_iterator rend(  ) const;
   
  bool empty(  ) const;
  size_type size(  ) const;
  size_type max_size(  ) const;
   
  pair<iterator,bool> insert(const value_type& x);
  iterator insert(iterator hintpos, const value_type& ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required