
\ccHtmlNoClassLinks
\begin{ccClassTemplate} {set<Key, Compare>}

\ccSection{set}

\ccDefinition
An object of the class \ccClassTemplateName\ stores unique elements of
type \ccStyle{Key}. It  allows for the retrieval for the elements
themselves. The elements in the set are ordered by the ordering
relation \ccStyle{Compare}.

% prevent dead links to non-CGAL include files
\ccHtmlLinksOff
\ccInclude{set}
\ccHtmlLinksOn

\ccTypes
\ccNestedType{iterator}{A const bidirectional iterator.}

\ccCreation
\ccCreationVariable{S}


\ccConstructor{set(const Compare& comp = Compare());}
             {Introduces an empty set.}

\ccConstructor{set(const set<Key, Compare> &S1);}
 	    {Copy constructor.}

\ccOperations

\ccMethod{set<Key, Compare> & operator=(const set<Key, Compare> &S1);}
        {Assignment.}

\ccMethod{bool operator==(const set<Key, Compare> &S1);}
{Equality test: Two sets are equal, if the sequences \ccVar\ and \ccStyle{S1}
 are elementwise equal.}


\ccMethod{bool operator<(const set<Key, Compare> &S1);}
{Returns \ccStyle{true} if \ccVar\ is lexicographically less than \ccStyle{S1},
 \ccStyle{false} otherwise.}

\ccMethod{set<Key, Compare>::iterator begin() const;}
       {Returns a constant iterator referring to the first element in
        set~\ccVar.}

\ccMethod{set<Key, Compare>::iterator end() const;}
       {Returns a constant past-the-end iterator of set~\ccVar.}

\ccMethod{bool empty() const;}
	{Returns \ccStyle{true} if \ccVar\ is empty.}

\ccMethod{int size() const;}
	{Returns the number of items in set~\ccVar.}

\ccHeading{Insert and Erase}

\ccMethod{set<Key, Compare>::iterator insert(set<Key, Compare>::iterator pos, 
	                                     const Key& k);}
{Inserts \ccStyle{k} in the set if \ccStyle{k} is not already
 present in \ccVar. The iterator \ccStyle{pos} is the starting point of
 the search.  The return value points to the inserted item.}

\ccMethod{pair<set<Key, Compare>::iterator, bool> insert(const Key& k);}
{Inserts \ccStyle{k} in the set if \ccStyle{k} is not already
 present in \ccVar. Returns a pair, where \ccStyle{first}
 is the iterator that points to the inserted item or to the
 item that is already present in \ccVar, and where \ccStyle{second}
 is \ccStyle{true} if the insertion took place.}

\ccMethod{void erase(set<Key, Compare>::iterator pos);}
{Erases the element where pos points to.}

\ccMethod{int erase(Key k);}
{Erases the element \ccStyle{k}, if present. Returns the number
 of erased elements.}

\ccHeading{Miscellaneous}

\ccMethod{set<Key, Compare>::iterator find(Key k);}
{Returns an iterator that either points to the element \ccStyle{k},
 or \ccStyle{end()} if \ccStyle{k} is not present in set \ccVar.}

\ccMethod{int count(Key k);}
{Returns the number of occurrences of \ccStyle{k} in set \ccVar.}


\ccMethod{set<Key, Compare>::iterator lower_bound(Key k);}
{Returns an iterator that points to the first element of \ccVar\ 
that is not less than \ccStyle{k}. If all elements are less than
\ccStyle{k} then \ccStyle{end()} is returned. If \ccStyle{k}
is present in the set the returned iterator points to \ccStyle{k}.}

\ccMethod{set<Key, Compare>::iterator upper_bound(Key k);}
{Returns an iterator that points to the first element of the set
that is greater than \ccStyle{k}. If no element is greater than
\ccStyle{k} then \ccStyle{end()} is returned.}

\end{ccClassTemplate} 
