\hypertarget{a00409}{
\section{mln::util::set$<$ T $>$ Class Template Reference}
\label{de/d3d/a00409}\index{mln::util::set@{mln::util::set}}
}


An \char`\"{}efficient\char`\"{} mathematical set class.  




{\ttfamily \#include $<$set.hh$>$}



Inheritance diagram for mln::util::set$<$ T $>$:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=280pt]{d7/d30/a04011}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
typedef set\_\-bkd\_\-iter$<$ T $>$ \hyperlink{a00409_aeaa2b8b21306405f6733b47f825e23ed}{bkd\_\-eiter}
\begin{DoxyCompactList}\small\item\em Backward iterator associated type. \item\end{DoxyCompactList}\item 
typedef \hyperlink{a00409_a8d92697d68c9488170a5365a70b193dd}{fwd\_\-eiter} \hyperlink{a00409_a91dfdb508a50a04f69debcc6c6cd6782}{eiter}
\begin{DoxyCompactList}\small\item\em \hyperlink{a00046}{Iterator} associated type. \item\end{DoxyCompactList}\item 
typedef T \hyperlink{a00409_a3a96b5d513fdf99dd282e6a4d037121f}{element}
\begin{DoxyCompactList}\small\item\em Element associated type. \item\end{DoxyCompactList}\item 
typedef set\_\-fwd\_\-iter$<$ T $>$ \hyperlink{a00409_a8d92697d68c9488170a5365a70b193dd}{fwd\_\-eiter}
\begin{DoxyCompactList}\small\item\em Forward iterator associated type. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{a00409_a6c257dde5f486bde1a4209644bc78c4f}{clear} ()
\begin{DoxyCompactList}\small\item\em Empty the set. \item\end{DoxyCompactList}\item 
const T \hyperlink{a00409_ac8dda8a71e8106591011b7d877fb7573}{first\_\-element} () const 
\begin{DoxyCompactList}\small\item\em Return the first element of the set. \item\end{DoxyCompactList}\item 
bool \hyperlink{a00409_ab02eac55bbcda9e31d273752bdd94459}{has} (const T \&elt) const 
\begin{DoxyCompactList}\small\item\em Test if the object {\ttfamily elt} belongs to the set. \item\end{DoxyCompactList}\item 
\hyperlink{a00409}{set}$<$ T $>$ \& \hyperlink{a00409_a95e18da3ec2c490a2b9d2582c81e8b7f}{insert} (const T \&elt)
\begin{DoxyCompactList}\small\item\em Insert an element {\ttfamily elt} into the set. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$typename U $>$ }\\\hyperlink{a00409}{set}$<$ T $>$ \& \hyperlink{a00409_a1b742fa672ffe09397cfc8b12947a135}{insert} (const \hyperlink{a00409}{set}$<$ U $>$ \&other)
\begin{DoxyCompactList}\small\item\em Insert the elements of {\ttfamily other} into the set. \item\end{DoxyCompactList}\item 
bool \hyperlink{a00409_a45aa32b6fdc9a399736c1e94377b9834}{is\_\-empty} () const 
\begin{DoxyCompactList}\small\item\em Test if the set is empty. \item\end{DoxyCompactList}\item 
const T \hyperlink{a00409_a7ceabb96932e585d8cf0c974a9ca5abd}{last\_\-element} () const 
\begin{DoxyCompactList}\small\item\em Return the last element of the set. \item\end{DoxyCompactList}\item 
std::size\_\-t \hyperlink{a00409_a373c5b2f0db665acbb29cd0cea775cd0}{memory\_\-size} () const 
\begin{DoxyCompactList}\small\item\em Return the size of this set in memory. \item\end{DoxyCompactList}\item 
unsigned \hyperlink{a00409_a28612ab18d0d8dd6f3bd42a9f6ba3f16}{nelements} () const 
\begin{DoxyCompactList}\small\item\em Return the number of elements of the set. \item\end{DoxyCompactList}\item 
const T \& \hyperlink{a00409_a40d8ba191cefd695bf39b08ab28f2303}{operator\mbox{[}$\,$\mbox{]}} (unsigned i) const 
\begin{DoxyCompactList}\small\item\em Return the i-\/th element of the set. \item\end{DoxyCompactList}\item 
\hyperlink{a00409}{set}$<$ T $>$ \& \hyperlink{a00409_a6fb29d0a4f55b94947d430318eff56c9}{remove} (const T \&elt)
\begin{DoxyCompactList}\small\item\em Remove an element {\ttfamily elt} into the set. \item\end{DoxyCompactList}\item 
\hyperlink{a00409_a9ef4f9b73da0c2175cef33cbc49a8232}{set} ()
\begin{DoxyCompactList}\small\item\em Constructor without arguments. \item\end{DoxyCompactList}\item 
const std::vector$<$ T $>$ \& \hyperlink{a00409_ae5ba8bb24a179f095e2ceab5504de0fb}{std\_\-vector} () const 
\begin{DoxyCompactList}\small\item\em Give access to the set elements. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename T$>$ class mln::util::set$<$ T $>$}

An \char`\"{}efficient\char`\"{} mathematical set class. This set class is designed to store a mathematical set and to present it to the user as a linear array (std::vector).

Elements are stored by copy. Implementation is lazy.

The set has two states: frozen or not. There is an automatic switch of state when the user modifies its contents (insert, remove, or clear) or access to its contents (op\mbox{[}i\mbox{]}).

The parameter {\ttfamily T} is the element type, which shall not be const-\/qualified.

The unicity of set elements is handled by the \hyperlink{a00406}{mln::util::ord} mechanism.

\begin{DoxySeeAlso}{See also}
\hyperlink{a00406}{mln::util::ord} 
\end{DoxySeeAlso}


Definition at line 81 of file util/set.hh.



\subsection{Member Typedef Documentation}
\hypertarget{a00409_aeaa2b8b21306405f6733b47f825e23ed}{
\index{mln::util::set@{mln::util::set}!bkd\_\-eiter@{bkd\_\-eiter}}
\index{bkd\_\-eiter@{bkd\_\-eiter}!mln::util::set@{mln::util::set}}
\subsubsection[{bkd\_\-eiter}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T$>$ typedef set\_\-bkd\_\-iter$<$T$>$ {\bf mln::util::set}$<$ T $>$::{\bf bkd\_\-eiter}}}
\label{de/d3d/a00409_aeaa2b8b21306405f6733b47f825e23ed}


Backward iterator associated type. 



Definition at line 93 of file util/set.hh.

\hypertarget{a00409_a91dfdb508a50a04f69debcc6c6cd6782}{
\index{mln::util::set@{mln::util::set}!eiter@{eiter}}
\index{eiter@{eiter}!mln::util::set@{mln::util::set}}
\subsubsection[{eiter}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T$>$ typedef {\bf fwd\_\-eiter} {\bf mln::util::set}$<$ T $>$::{\bf eiter}}}
\label{de/d3d/a00409_a91dfdb508a50a04f69debcc6c6cd6782}


\hyperlink{a00046}{Iterator} associated type. 



Definition at line 96 of file util/set.hh.

\hypertarget{a00409_a3a96b5d513fdf99dd282e6a4d037121f}{
\index{mln::util::set@{mln::util::set}!element@{element}}
\index{element@{element}!mln::util::set@{mln::util::set}}
\subsubsection[{element}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T$>$ typedef T {\bf mln::util::set}$<$ T $>$::{\bf element}}}
\label{de/d3d/a00409_a3a96b5d513fdf99dd282e6a4d037121f}


Element associated type. 



Definition at line 86 of file util/set.hh.

\hypertarget{a00409_a8d92697d68c9488170a5365a70b193dd}{
\index{mln::util::set@{mln::util::set}!fwd\_\-eiter@{fwd\_\-eiter}}
\index{fwd\_\-eiter@{fwd\_\-eiter}!mln::util::set@{mln::util::set}}
\subsubsection[{fwd\_\-eiter}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T$>$ typedef set\_\-fwd\_\-iter$<$T$>$ {\bf mln::util::set}$<$ T $>$::{\bf fwd\_\-eiter}}}
\label{de/d3d/a00409_a8d92697d68c9488170a5365a70b193dd}


Forward iterator associated type. 



Definition at line 90 of file util/set.hh.



\subsection{Constructor \& Destructor Documentation}
\hypertarget{a00409_a9ef4f9b73da0c2175cef33cbc49a8232}{
\index{mln::util::set@{mln::util::set}!set@{set}}
\index{set@{set}!mln::util::set@{mln::util::set}}
\subsubsection[{set}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ {\bf mln::util::set}$<$ T $>$::{\bf set} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a9ef4f9b73da0c2175cef33cbc49a8232}


Constructor without arguments. 



Definition at line 348 of file util/set.hh.



\subsection{Member Function Documentation}
\hypertarget{a00409_a6c257dde5f486bde1a4209644bc78c4f}{
\index{mln::util::set@{mln::util::set}!clear@{clear}}
\index{clear@{clear}!mln::util::set@{mln::util::set}}
\subsubsection[{clear}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ void {\bf mln::util::set}$<$ T $>$::clear (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a6c257dde5f486bde1a4209644bc78c4f}


Empty the set. 

All elements contained in the set are destroyed so the set is emptied.

\begin{DoxyPostcond}{Postcondition}
\hyperlink{a00409_a45aa32b6fdc9a399736c1e94377b9834}{is\_\-empty()} == true 
\end{DoxyPostcond}


Definition at line 390 of file util/set.hh.



References mln::util::set$<$ T $>$::is\_\-empty().

\hypertarget{a00409_ac8dda8a71e8106591011b7d877fb7573}{
\index{mln::util::set@{mln::util::set}!first\_\-element@{first\_\-element}}
\index{first\_\-element@{first\_\-element}!mln::util::set@{mln::util::set}}
\subsubsection[{first\_\-element}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ const T {\bf mln::util::set}$<$ T $>$::first\_\-element (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_ac8dda8a71e8106591011b7d877fb7573}


Return the first element of the set. 

\begin{DoxyPrecond}{Precondition}
not \hyperlink{a00409_a45aa32b6fdc9a399736c1e94377b9834}{is\_\-empty()} 
\end{DoxyPrecond}


Definition at line 427 of file util/set.hh.



References mln::util::set$<$ T $>$::is\_\-empty().

\hypertarget{a00409_ab02eac55bbcda9e31d273752bdd94459}{
\index{mln::util::set@{mln::util::set}!has@{has}}
\index{has@{has}!mln::util::set@{mln::util::set}}
\subsubsection[{has}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ bool {\bf mln::util::set}$<$ T $>$::has (
\begin{DoxyParamCaption}
\item[{const T \&}]{ elt}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_ab02eac55bbcda9e31d273752bdd94459}


Test if the object {\ttfamily elt} belongs to the set. 


\begin{DoxyParams}{Parameters}
\item[\mbox{\tt[in]} {\em elt}]A possible element of the set.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
True is {\ttfamily elt} is in the set. 
\end{DoxyReturn}


Definition at line 445 of file util/set.hh.

\hypertarget{a00409_a95e18da3ec2c490a2b9d2582c81e8b7f}{
\index{mln::util::set@{mln::util::set}!insert@{insert}}
\index{insert@{insert}!mln::util::set@{mln::util::set}}
\subsubsection[{insert}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ {\bf set}$<$ T $>$ \& {\bf mln::util::set}$<$ T $>$::insert (
\begin{DoxyParamCaption}
\item[{const T \&}]{ elt}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a95e18da3ec2c490a2b9d2582c81e8b7f}


Insert an element {\ttfamily elt} into the set. 


\begin{DoxyParams}{Parameters}
\item[\mbox{\tt[in]} {\em elt}]The element to be inserted.\end{DoxyParams}
If {\ttfamily elt} is already in the set, this method is a no-\/op.

\begin{DoxyReturn}{Returns}
The set itself after insertion. 
\end{DoxyReturn}


Definition at line 356 of file util/set.hh.



Referenced by mln::p\_\-key$<$ K, P $>$::change\_\-keys().

\hypertarget{a00409_a1b742fa672ffe09397cfc8b12947a135}{
\index{mln::util::set@{mln::util::set}!insert@{insert}}
\index{insert@{insert}!mln::util::set@{mln::util::set}}
\subsubsection[{insert}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ template$<$typename U $>$ {\bf set}$<$ T $>$ \& {\bf mln::util::set}$<$ T $>$::insert (
\begin{DoxyParamCaption}
\item[{const {\bf set}$<$ U $>$ \&}]{ other}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a1b742fa672ffe09397cfc8b12947a135}


Insert the elements of {\ttfamily other} into the set. 


\begin{DoxyParams}{Parameters}
\item[\mbox{\tt[in]} {\em other}]The set containing the elements to be inserted.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The set itself after insertion. 
\end{DoxyReturn}


Definition at line 367 of file util/set.hh.



References mln::util::set$<$ T $>$::is\_\-empty(), and mln::util::set$<$ T $>$::std\_\-vector().

\hypertarget{a00409_a45aa32b6fdc9a399736c1e94377b9834}{
\index{mln::util::set@{mln::util::set}!is\_\-empty@{is\_\-empty}}
\index{is\_\-empty@{is\_\-empty}!mln::util::set@{mln::util::set}}
\subsubsection[{is\_\-empty}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ bool {\bf mln::util::set}$<$ T $>$::is\_\-empty (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a45aa32b6fdc9a399736c1e94377b9834}


Test if the set is empty. 



Definition at line 453 of file util/set.hh.



References mln::util::set$<$ T $>$::nelements().



Referenced by mln::util::set$<$ T $>$::clear(), mln::util::set$<$ T $>$::first\_\-element(), mln::util::set$<$ T $>$::insert(), and mln::util::set$<$ T $>$::last\_\-element().

\hypertarget{a00409_a7ceabb96932e585d8cf0c974a9ca5abd}{
\index{mln::util::set@{mln::util::set}!last\_\-element@{last\_\-element}}
\index{last\_\-element@{last\_\-element}!mln::util::set@{mln::util::set}}
\subsubsection[{last\_\-element}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ const T {\bf mln::util::set}$<$ T $>$::last\_\-element (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a7ceabb96932e585d8cf0c974a9ca5abd}


Return the last element of the set. 

\begin{DoxyPrecond}{Precondition}
not \hyperlink{a00409_a45aa32b6fdc9a399736c1e94377b9834}{is\_\-empty()} 
\end{DoxyPrecond}


Definition at line 436 of file util/set.hh.



References mln::util::set$<$ T $>$::is\_\-empty().

\hypertarget{a00409_a373c5b2f0db665acbb29cd0cea775cd0}{
\index{mln::util::set@{mln::util::set}!memory\_\-size@{memory\_\-size}}
\index{memory\_\-size@{memory\_\-size}!mln::util::set@{mln::util::set}}
\subsubsection[{memory\_\-size}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ std::size\_\-t {\bf mln::util::set}$<$ T $>$::memory\_\-size (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a373c5b2f0db665acbb29cd0cea775cd0}


Return the size of this set in memory. 



Definition at line 494 of file util/set.hh.



References mln::util::set$<$ T $>$::nelements().

\hypertarget{a00409_a28612ab18d0d8dd6f3bd42a9f6ba3f16}{
\index{mln::util::set@{mln::util::set}!nelements@{nelements}}
\index{nelements@{nelements}!mln::util::set@{mln::util::set}}
\subsubsection[{nelements}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ unsigned {\bf mln::util::set}$<$ T $>$::nelements (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a28612ab18d0d8dd6f3bd42a9f6ba3f16}


Return the number of elements of the set. 



Definition at line 409 of file util/set.hh.



Referenced by mln::util::set$<$ T $>$::is\_\-empty(), mln::util::set$<$ T $>$::memory\_\-size(), and mln::util::set$<$ T $>$::operator\mbox{[}$\,$\mbox{]}().

\hypertarget{a00409_a40d8ba191cefd695bf39b08ab28f2303}{
\index{mln::util::set@{mln::util::set}!operator\mbox{[}\mbox{]}@{operator[]}}
\index{operator\mbox{[}\mbox{]}@{operator[]}!mln::util::set@{mln::util::set}}
\subsubsection[{operator[]}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ const T \& {\bf mln::util::set}$<$ T $>$::operator\mbox{[}$\,$\mbox{]} (
\begin{DoxyParamCaption}
\item[{unsigned}]{ i}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a40d8ba191cefd695bf39b08ab28f2303}


Return the i-\/th element of the set. 


\begin{DoxyParams}{Parameters}
\item[\mbox{\tt[in]} {\em i}]Index of the element to retrieve.\end{DoxyParams}
\begin{DoxyPrecond}{Precondition}
i $<$ \hyperlink{a00409_a28612ab18d0d8dd6f3bd42a9f6ba3f16}{nelements()}
\end{DoxyPrecond}
The element is returned by reference and is constant. 

Definition at line 417 of file util/set.hh.



References mln::util::set$<$ T $>$::nelements().

\hypertarget{a00409_a6fb29d0a4f55b94947d430318eff56c9}{
\index{mln::util::set@{mln::util::set}!remove@{remove}}
\index{remove@{remove}!mln::util::set@{mln::util::set}}
\subsubsection[{remove}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ {\bf set}$<$ T $>$ \& {\bf mln::util::set}$<$ T $>$::remove (
\begin{DoxyParamCaption}
\item[{const T \&}]{ elt}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_a6fb29d0a4f55b94947d430318eff56c9}


Remove an element {\ttfamily elt} into the set. 


\begin{DoxyParams}{Parameters}
\item[\mbox{\tt[in]} {\em elt}]The element to be inserted.\end{DoxyParams}
If {\ttfamily elt} is already in the set, this method is a no-\/op.

\begin{DoxyReturn}{Returns}
The set itself after suppression. 
\end{DoxyReturn}


Definition at line 380 of file util/set.hh.

\hypertarget{a00409_ae5ba8bb24a179f095e2ceab5504de0fb}{
\index{mln::util::set@{mln::util::set}!std\_\-vector@{std\_\-vector}}
\index{std\_\-vector@{std\_\-vector}!mln::util::set@{mln::util::set}}
\subsubsection[{std\_\-vector}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ const std::vector$<$ T $>$ \& {\bf mln::util::set}$<$ T $>$::std\_\-vector (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{de/d3d/a00409_ae5ba8bb24a179f095e2ceab5504de0fb}


Give access to the set elements. 

The complexity of this method is O(1).

\begin{DoxyPostcond}{Postcondition}
The set is frozen.
\end{DoxyPostcond}
\begin{DoxyReturn}{Returns}
An array (std::vector) of elements. 
\end{DoxyReturn}


Definition at line 461 of file util/set.hh.



Referenced by mln::util::set$<$ T $>$::insert().

