Added Compare parameter to Min/Max.

This commit is contained in:
Michael Hoffmann 2001-07-06 08:53:41 +00:00
parent 5f18d1e0c4
commit 2b6c0fdd91
4 changed files with 23 additions and 15 deletions

View File

@ -58,15 +58,15 @@ In fact \ccc{double} and \ccc{float} also fulfill the requirements.
\ccCreationVariable{ntvar}
\ccConstructor{NT();}
{Declaration of a variable.}
{Declaration of a variable.}
\ccConstructor{NT(const NT &ntval);}
{Declaration and initialization.}
{Declaration and initialization.}
\ccConstructor{NT(i)}
{Declaration and initialization with a small integer
{Declaration and initialization with a small integer
constant $i$, $0 \leq i \leq 127$. The neutral elements for addition
(zero) and multiplication (one) are needed quite often, but sometimes
other small constants are useful too. The value 127 was chosen such
@ -225,8 +225,8 @@ named \ccc{Sgn} in order to avoid a conflict with the type
\ccInclude{CGAL/number_utils_classes.h}
\ccc{class Min<NT>;}\\
\ccc{class Max<NT>;}\\
\ccc{class Min<NT,Compare=std::less>;}\\
\ccc{class Max<NT,Compare=std::less>;}\\
\ccc{class Abs<NT>;}\\
\ccc{class Sgn<NT>;}\\
\ccc{class Is_negative<NT>;}\\

View File

@ -58,15 +58,15 @@ In fact \ccc{double} and \ccc{float} also fulfill the requirements.
\ccCreationVariable{ntvar}
\ccConstructor{NT();}
{Declaration of a variable.}
{Declaration of a variable.}
\ccConstructor{NT(const NT &ntval);}
{Declaration and initialization.}
{Declaration and initialization.}
\ccConstructor{NT(i)}
{Declaration and initialization with a small integer
{Declaration and initialization with a small integer
constant $i$, $0 \leq i \leq 127$. The neutral elements for addition
(zero) and multiplication (one) are needed quite often, but sometimes
other small constants are useful too. The value 127 was chosen such
@ -225,8 +225,8 @@ named \ccc{Sgn} in order to avoid a conflict with the type
\ccInclude{CGAL/number_utils_classes.h}
\ccc{class Min<NT>;}\\
\ccc{class Max<NT>;}\\
\ccc{class Min<NT,Compare=std::less>;}\\
\ccc{class Max<NT,Compare=std::less>;}\\
\ccc{class Abs<NT>;}\\
\ccc{class Sgn<NT>;}\\
\ccc{class Is_negative<NT>;}\\

View File

@ -88,18 +88,26 @@ struct Abs :public CGAL_STD::unary_function< NT, NT > {
{ return abs( x); }
};
template < class NT >
template < class NT, class Compare = std::less< NT > >
struct Min :public CGAL_STD::binary_function< NT, NT, NT > {
typedef Arity_tag< 2 > Arity;
Min() {}
Min(const Compare& c_) : c(c_) {}
NT operator()( const NT& x, const NT& y) const
{ return std::min( x, y); }
{ return std::min( x, y, c); }
protected:
Compare c;
};
template < class NT >
template < class NT, class Compare = std::less< NT > >
struct Max :public CGAL_STD::binary_function< NT, NT, NT > {
typedef Arity_tag< 2 > Arity;
Max() {}
Max(const Compare& c_) : c(c_) {}
NT operator()( const NT& x, const NT& y) const
{ return std::max( x, y); }
{ return std::max( x, y, c); }
protected:
Compare c;
};
template < class NT >

View File

@ -1 +1 @@
4.26 (27 Jun 2001)
4.27 (06 Jul 2001)