1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; version 2.1 of the License.
// See the file LICENSE.LGPL distributed with CGAL.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Number_types/include/CGAL/utils_classes.h $
// $Id: utils_classes.h 47264 2008-12-08 06:25:14Z hemmer $
//
//
// Author(s) : Michael Hemmer <hemmer@mpi-sb.mpg.de>
#ifndef CGAL_UTILS_CLASSES_H
#define CGAL_UTILS_CLASSES_H
#include <CGAL/basic.h>
CGAL_BEGIN_NAMESPACE
template < class A, class B = A >
struct Equal_to : public std::binary_function< A, B, bool > {
bool operator()( const A& x, const B& y) const
{ return x == y; }
};
template < class A, class B = A >
struct Not_equal_to : public std::binary_function< A, B, bool > {
bool operator()( const A& x, const B& y) const
{ return x != y; }
};
template < class A, class B = A >
struct Greater : public std::binary_function< A, B, bool > {
bool operator()( const A& x, const B& y) const
{ return x > y; }
};
template < class A, class B = A >
struct Less : public std::binary_function< A, B, bool > {
bool operator()( const A& x, const B& y) const
{ return x < y; }
};
template < class A, class B = A >
struct Greater_equal : public std::binary_function< A, B, bool > {
bool operator()( const A& x, const B& y) const
{ return x >= y; }
};
template < class A, class B = A >
struct Less_equal : public std::binary_function< A, B, bool > {
bool operator()( const A& x, const B& y) const
{ return x <= y; }
};
template < class NT, class Less = std::less< NT > >
struct Min :public std::binary_function< NT, NT, NT > {
Min() {}
Min(const Less& c_) : c(c_) {}
NT operator()( const NT& x, const NT& y) const
{ return (std::min) BOOST_PREVENT_MACRO_SUBSTITUTION ( x, y, c); }
protected:
Less c;
};
template < class NT, class Less = std::less< NT > >
struct Max :public std::binary_function< NT, NT, NT > {
Max() {}
Max(const Less& c_) : c(c_) {}
NT operator()( const NT& x, const NT& y) const
{ return (std::max) BOOST_PREVENT_MACRO_SUBSTITUTION ( x, y, c); }
protected:
Less c;
};
template< class T >
class Is_valid
: public std::unary_function< T, bool > {
public:
bool operator()( const T& ) const {
return true;
};
};
CGAL_END_NAMESPACE
#endif // CGAL_UTILS_CLASSES_H
|