cgal/Manual/doc_tex/Use_of_Stl/Preliminaries.tex

55 lines
1.1 KiB
TeX

\cleardoublepage
\chapter{Preliminaries}
\ccHtmlNoClassLinks
\begin{ccClassTemplate}{pair<T1, T2>}
\ccSection{Pair}
\ccDefinition
A struct \ccClassName\ is a heterogeneous pair of values. Its data members
are \ccStyle{first} and \ccStyle{second}.
\ccInclude{pair}
\ccCreation
\ccCreationVariable{p}
\ccConstructor{pair(const T1& x, const T2& y);}
{Introduces a pair.}
\ccOperations
\ccGlobalFunction{template <class T1, class T2>
bool operator==(const pair<T1,T2> &p, const pair<T1,T2> &p1) const;}
{Test for equality: Two pairs are equal, iff their data members are equal.}
\ccGlobalFunction{template <class T1, class T2>
bool operator<(const pair<T1,T2> &p,
const pair<T1,T2> &p1) const;}
{Lexicographical comparison of two pairs.}
\ccExample
\begin{cprog}
Employee irene("Irene", "Eneri");
Employee leo("Leonard", "Eneri");
typedef int Social_security_number;
pair<Social_security_number, Employee> p1(7812, irene), p2(5555, leo);
assert( p1.first == 7812 );
assert( p2.second == leo );
\end{cprog}
\end{ccClassTemplate}