00001
00002 #ifndef _INSTIGATE_STL_INTERNAL_HEADER_IN_ALGORITHM
00003 #error This is an internal header file used to implement Instigate STL.\
00004 It should never be included directly by a program.
00005 #endif
00006
00007 #ifndef INSTIGATE_STL_MIN_HPP
00008 #define INSTIGATE_STL_MIN_HPP
00009
00058
00059 #include "concept.hpp"
00060 #include "_basis.hpp"
00061
00062
00063
00064
00065
00066
00067 namespace instigate {
00068 namespace stl {
00069 template <typename T>
00070 inline const T& min(const T& a, const T& b);
00071 template <typename T, typename B>
00072 inline const T& min(const T& a, const T& b, B p);
00073 }
00074 }
00075
00096 template <typename T>
00097 inline const T& instigate::stl::min(const T& a, const T& b)
00098 {
00099 namespace LT = instigate::generic::less_than_comparable;
00100 CHECK(LT::requirements<T>);
00101 return less_than(b, a) ? b : a;
00102 }
00103
00127 template <typename T, typename B>
00128 inline const T& instigate::stl::min(const T& a, const T& b, B p)
00129 {
00130 namespace BP = instigate::stl::binary_predicate;
00131 CHECK(BP::requirements<B>);
00132 CHECK_CONVERTIBILITY(T, typename BP::interface<B>::first_argument_type);
00133 CHECK_CONVERTIBILITY(T,typename BP::interface<B>::second_argument_type);
00134 return invoke_predicate(p, b, a) ? b : a;
00135 }
00136
00137
00138
00139 #endif // INSTIGATE_STL_MIN_HPP