33 #include <type_traits> 41 inline bool compare(
const T & a,
const T & b, std::false_type)
47 inline bool compare(
const T & a,
const T & b, std::true_type)
52 if(a == b)
return true;
53 else return ( std::abs(a - b) <
EPSILON || (std::abs(a - b) / std::max(std::abs(a), std::abs(b))) <
EPSILON ) ;
59 public std::binary_function< T, T, bool >
63 return compare(a,b, std::is_floating_point<T>());
67 template <
typename T >
68 struct absdiff : std::binary_function<T, T, T>
73 return abs( arg1 - arg2 );
78 template<
class IT,
class NT>
80 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
82 inline bool operator()(
const std::tuple<IT, IT, NT> & lhs,
const std::tuple<IT, IT, NT> & rhs)
const 84 return ( (std::get<0>(lhs) == std::get<0>(rhs)) && (std::get<1>(lhs) == std::get<1>(rhs)) );
94 template <
class IT,
class NT>
96 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
98 inline bool operator()(
const std::tuple<IT, IT, NT> & lhs,
const std::tuple<IT, IT, NT> & rhs)
const 100 if(std::get<1>(lhs) == std::get<1>(rhs))
102 return std::get<0>(lhs) < std::get<0>(rhs);
106 return std::get<1>(lhs) < std::get<1>(rhs);
111 template <
class IT,
class NT>
113 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
115 inline bool operator()(
const std::tuple<IT, IT, NT> & lhs,
const std::tuple<IT, IT, NT> & rhs)
const 117 if(std::get<0>(lhs) == std::get<0>(rhs))
119 return std::get<1>(lhs) < std::get<1>(rhs);
123 return std::get<0>(lhs) < std::get<0>(rhs);
130 template <
class IT,
class NT>
132 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
134 inline bool operator()(
const std::tuple<IT, IT, NT> & lhs,
const std::tuple<IT, IT, NT> & rhs)
const 136 return std::get<1>(lhs) < std::get<1>(rhs);
141 template <
class IT,
class NT>
143 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
145 inline bool operator()(
const std::tuple<IT, IT, NT> & lhs,
const std::tuple<IT, IT, NT> & rhs)
const 147 return std::get<0>(lhs) < std::get<0>(rhs);
151 template <
class IT,
class NT>
153 public std::binary_function< std::pair< std::tuple<IT, IT, NT> , int > , std::pair< std::tuple<IT, IT, NT> , int>, bool >
155 inline bool operator()(
const std::pair< std::tuple<IT, IT, NT> ,
int > & lhs,
const std::pair< std::tuple<IT, IT, NT> ,
int > & rhs)
const 157 if(std::get<1>(lhs.first) == std::get<1>(rhs.first))
159 return std::get<0>(lhs.first) < std::get<0>(rhs.first);
163 return std::get<1>(lhs.first) < std::get<1>(rhs.first);
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
bool operator()(const T &a, const T &b) const
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
bool operator()(const std::pair< std::tuple< IT, IT, NT >, int > &lhs, const std::pair< std::tuple< IT, IT, NT >, int > &rhs) const
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
bool compare(const T &a, const T &b, std::false_type)