|
|
@ -46,6 +46,100 @@ namespace mrw { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
//@{
|
|
|
|
//@{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @defgroup getmax Get the Maximum of Values */ |
|
|
|
|
|
|
|
//@{
|
|
|
|
|
|
|
|
//! Get the maximum out of two values
|
|
|
|
|
|
|
|
template<typename T> T& max(T& t1, T& t2) { |
|
|
|
|
|
|
|
return t2<t1?t1:t2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the maximum out of three values
|
|
|
|
|
|
|
|
template<typename T> T& max(T& t1, T& t2, T& t3) { |
|
|
|
|
|
|
|
return max(t1, max(t2, t3)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the maximum out of four values
|
|
|
|
|
|
|
|
template<typename T> T& max(T& t1, T& t2, T& t3, T& t4) { |
|
|
|
|
|
|
|
return max(max(t1, t2), max(t3, t4)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the maximum out of five values
|
|
|
|
|
|
|
|
template<typename T> T& max(T& t1, T& t2, T& t3, T& t4, T& t5) { |
|
|
|
|
|
|
|
return max(max(t1, t2), max(t3, t4, t5)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the maximum out of six values
|
|
|
|
|
|
|
|
template<typename T> T& max(T& t1, T& t2, T& t3, T& t4, T& t5, T& t6) { |
|
|
|
|
|
|
|
return max(max(t1, t2, t3), max(t4, t5, t6)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the maximum out of two values
|
|
|
|
|
|
|
|
template<typename T> const T& max(const T& t1, const T& t2) { |
|
|
|
|
|
|
|
return t2<t1?t1:t2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the maximum out of three values
|
|
|
|
|
|
|
|
template<typename T> const T& max(const T& t1, const T& t2, const T& t3) { |
|
|
|
|
|
|
|
return max(t1, max(t2, t3)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the maximum out of four values
|
|
|
|
|
|
|
|
template<typename T> const T& max(const T& t1, const T& t2, const T& t3, |
|
|
|
|
|
|
|
const T& t4) { |
|
|
|
|
|
|
|
return max(max(t1, t2), max(t3, t4)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the maximum out of five values
|
|
|
|
|
|
|
|
template<typename T> const T& max(const T& t1, const T& t2, const T& t3, |
|
|
|
|
|
|
|
const T& t4, const T& t5) { |
|
|
|
|
|
|
|
return max(max(t1, t2), max(t3, t4, t5)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the maximum out of six values
|
|
|
|
|
|
|
|
template<typename T> const T& max(const T& t1, const T& t2, const T& t3, |
|
|
|
|
|
|
|
const T& t4, const T& t5, const T& t6) { |
|
|
|
|
|
|
|
return max(max(t1, t2, t3), max(t4, t5, t6)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @defgroup getmin Get the Minimum of Values */ |
|
|
|
|
|
|
|
//@{
|
|
|
|
|
|
|
|
//! Get the minimum out of two values
|
|
|
|
|
|
|
|
template<typename T> T& min(T& t1, T& t2) { |
|
|
|
|
|
|
|
return t1<t2?t1:t2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the minimum out of three values
|
|
|
|
|
|
|
|
template<typename T> T& min(T& t1, T& t2, T& t3) { |
|
|
|
|
|
|
|
return min(t1, min(t2, t3)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the minimum out of four values
|
|
|
|
|
|
|
|
template<typename T> T& min(T& t1, T& t2, T& t3, T& t4) { |
|
|
|
|
|
|
|
return min(min(t1, t2), min(t3, t4)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the minimum out of five values
|
|
|
|
|
|
|
|
template<typename T> T& min(T& t1, T& t2, T& t3, T& t4, T& t5) { |
|
|
|
|
|
|
|
return min(min(t1, t2), min(t3, t4, t5)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the minimum out of six values
|
|
|
|
|
|
|
|
template<typename T> T& min(T& t1, T& t2, T& t3, T& t4, T& t5, T& t6) { |
|
|
|
|
|
|
|
return min(min(t1, t2, t3), min(t4, t5, t6)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the minimum out of two values
|
|
|
|
|
|
|
|
template<typename T> const T& min(const T& t1, const T& t2) { |
|
|
|
|
|
|
|
return t2<t1?t1:t2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the minimum out of three values
|
|
|
|
|
|
|
|
template<typename T> const T& min(const T& t1, const T& t2, const T& t3) { |
|
|
|
|
|
|
|
return min(t1, min(t2, t3)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the minimum out of four values
|
|
|
|
|
|
|
|
template<typename T> const T& min(const T& t1, const T& t2, const T& t3, |
|
|
|
|
|
|
|
const T& t4) { |
|
|
|
|
|
|
|
return min(min(t1, t2), min(t3, t4)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the minimum out of five values
|
|
|
|
|
|
|
|
template<typename T> const T& min(const T& t1, const T& t2, const T& t3, |
|
|
|
|
|
|
|
const T& t4, const T& t5) { |
|
|
|
|
|
|
|
return min(min(t1, t2), min(t3, t4, t5)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//! Get the minimum out of six values
|
|
|
|
|
|
|
|
template<typename T> const T& min(const T& t1, const T& t2, const T& t3, |
|
|
|
|
|
|
|
const T& t4, const T& t5, const T& t6) { |
|
|
|
|
|
|
|
return min(min(t1, t2, t3), min(t4, t5, t6)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
|
|
/** @brief Dual <code>?:</code> operation:
|
|
|
|
/** @brief Dual <code>?:</code> operation:
|
|
|
|
<code>a ? a : b</code> |
|
|
|
<code>a ? a : b</code> |
|
|
|
|
|
|
|
|
|
|
|