BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/min_max_n.h
Go to the documentation of this file.
00001 // Copyright (c) 2006  INRIA Sophia-Antipolis (France).
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 // Licensees holding a valid commercial license may use this file in
00010 // accordance with the commercial license agreement provided with the software.
00011 //
00012 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014 //
00015 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/STL_Extension/include/CGAL/min_max_n.h $
00016 // $Id: min_max_n.h 46206 2008-10-11 20:21:08Z spion $
00017 //
00018 //
00019 // Author(s)     : Sylvain Pion
00020 
00021 #ifndef CGAL_MIN_MAX_N_H
00022 #define CGAL_MIN_MAX_N_H
00023 
00024 #include <CGAL/basic.h>
00025 
00026 CGAL_BEGIN_NAMESPACE
00027 
00028 // min_n() and max_n() functions similar to std::min() and std::max(),
00029 // but which allow more than 2 arguments.
00030 // Hopefully the next standard will have a variadic version of them.
00031 
00032 // Currently implemented for up to 8 arguments.
00033 // TODO : to be documented (or wait for the next standard to have it?)
00034 
00035 template < typename T > inline
00036 const T&
00037 min_n(const T& t0, const T& t1)
00038 { return (std::min)(t0, t1); }
00039 
00040 template < typename T > inline
00041 const T&
00042 min_n(const T& t0, const T& t1, const T& t2)
00043 { return (std::min)(t0, (std::min)(t1, t2)); }
00044 
00045 template < typename T > inline
00046 const T&
00047 min_n(const T& t0, const T& t1, const T& t2, const T& t3)
00048 { return (std::min)(t0, min_n(t1, t2, t3)); }
00049 
00050 template < typename T > inline
00051 const T&
00052 min_n(const T& t0, const T& t1, const T& t2, const T& t3, const T& t4)
00053 { return (std::min)(t0, min_n(t1, t2, t3, t4)); }
00054 
00055 template < typename T > inline
00056 const T&
00057 min_n(const T& t0, const T& t1, const T& t2, const T& t3, const T& t4,
00058       const T& t5)
00059 { return (std::min)(t0, min_n(t1, t2, t3, t4, t5)); }
00060 
00061 template < typename T > inline
00062 const T&
00063 min_n(const T& t0, const T& t1, const T& t2, const T& t3, const T& t4,
00064       const T& t5, const T& t6)
00065 { return (std::min)(t0, min_n(t1, t2, t3, t4, t5, t6)); }
00066 
00067 template < typename T > inline
00068 const T&
00069 min_n(const T& t0, const T& t1, const T& t2, const T& t3, const T& t4,
00070       const T& t5, const T& t6, const T& t7)
00071 { return (std::min)(t0, min_n(t1, t2, t3, t4, t5, t6, t7)); }
00072 
00073 
00074 template < typename T > inline
00075 const T&
00076 max_n(const T& t0, const T& t1)
00077 { return (std::max)(t0, t1); }
00078 
00079 template < typename T > inline
00080 const T&
00081 max_n(const T& t0, const T& t1, const T& t2)
00082 { return (std::max)(t0, (std::max)(t1, t2)); }
00083 
00084 template < typename T > inline
00085 const T&
00086 max_n(const T& t0, const T& t1, const T& t2, const T& t3)
00087 { return (std::max)(t0, max_n(t1, t2, t3)); }
00088 
00089 template < typename T > inline
00090 const T&
00091 max_n(const T& t0, const T& t1, const T& t2, const T& t3, const T& t4)
00092 { return (std::max)(t0, max_n(t1, t2, t3, t4)); }
00093 
00094 template < typename T > inline
00095 const T&
00096 max_n(const T& t0, const T& t1, const T& t2, const T& t3, const T& t4,
00097       const T& t5)
00098 { return (std::max)(t0, max_n(t1, t2, t3, t4, t5)); }
00099 
00100 template < typename T > inline
00101 const T&
00102 max_n(const T& t0, const T& t1, const T& t2, const T& t3, const T& t4,
00103       const T& t5, const T& t6)
00104 { return (std::max)(t0, max_n(t1, t2, t3, t4, t5, t6)); }
00105 
00106 template < typename T > inline
00107 const T&
00108 max_n(const T& t0, const T& t1, const T& t2, const T& t3, const T& t4,
00109       const T& t5, const T& t6, const T& t7)
00110 { return (std::max)(t0, max_n(t1, t2, t3, t4, t5, t6, t7)); }
00111 
00112 CGAL_END_NAMESPACE
00113 
00114 #endif // CGAL_MIN_MAX_N_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines