|
BWAPI
|
00001 // Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany) 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License as 00006 // published by the Free Software Foundation; version 2.1 of the License. 00007 // See the file LICENSE.LGPL distributed with CGAL. 00008 // 00009 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00010 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00011 // 00012 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Number_types/include/CGAL/utils_classes.h $ 00013 // $Id: utils_classes.h 47264 2008-12-08 06:25:14Z hemmer $ 00014 // 00015 // 00016 // Author(s) : Michael Hemmer <hemmer@mpi-sb.mpg.de> 00017 00018 #ifndef CGAL_UTILS_CLASSES_H 00019 #define CGAL_UTILS_CLASSES_H 00020 #include <CGAL/basic.h> 00021 00022 CGAL_BEGIN_NAMESPACE 00023 00024 template < class A, class B = A > 00025 struct Equal_to : public std::binary_function< A, B, bool > { 00026 bool operator()( const A& x, const B& y) const 00027 { return x == y; } 00028 }; 00029 00030 template < class A, class B = A > 00031 struct Not_equal_to : public std::binary_function< A, B, bool > { 00032 bool operator()( const A& x, const B& y) const 00033 { return x != y; } 00034 }; 00035 00036 template < class A, class B = A > 00037 struct Greater : public std::binary_function< A, B, bool > { 00038 bool operator()( const A& x, const B& y) const 00039 { return x > y; } 00040 }; 00041 00042 template < class A, class B = A > 00043 struct Less : public std::binary_function< A, B, bool > { 00044 bool operator()( const A& x, const B& y) const 00045 { return x < y; } 00046 }; 00047 00048 template < class A, class B = A > 00049 struct Greater_equal : public std::binary_function< A, B, bool > { 00050 bool operator()( const A& x, const B& y) const 00051 { return x >= y; } 00052 }; 00053 00054 template < class A, class B = A > 00055 struct Less_equal : public std::binary_function< A, B, bool > { 00056 bool operator()( const A& x, const B& y) const 00057 { return x <= y; } 00058 }; 00059 00060 template < class NT, class Less = std::less< NT > > 00061 struct Min :public std::binary_function< NT, NT, NT > { 00062 Min() {} 00063 Min(const Less& c_) : c(c_) {} 00064 NT operator()( const NT& x, const NT& y) const 00065 { return (std::min) BOOST_PREVENT_MACRO_SUBSTITUTION ( x, y, c); } 00066 protected: 00067 Less c; 00068 }; 00069 00070 template < class NT, class Less = std::less< NT > > 00071 struct Max :public std::binary_function< NT, NT, NT > { 00072 Max() {} 00073 Max(const Less& c_) : c(c_) {} 00074 NT operator()( const NT& x, const NT& y) const 00075 { return (std::max) BOOST_PREVENT_MACRO_SUBSTITUTION ( x, y, c); } 00076 protected: 00077 Less c; 00078 }; 00079 00080 template< class T > 00081 class Is_valid 00082 : public std::unary_function< T, bool > { 00083 public: 00084 bool operator()( const T& ) const { 00085 return true; 00086 }; 00087 }; 00088 00089 CGAL_END_NAMESPACE 00090 00091 #endif // CGAL_UTILS_CLASSES_H
1.7.6.1