| Line | |
|---|
| 1 | // =========================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : arb_algo.h // |
|---|
| 4 | // Purpose : idioms based on algorithm // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Ralf Westram (coder@reallysoft.de) in May 2012 // |
|---|
| 7 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 8 | // http://www.arb-home.de/ // |
|---|
| 9 | // // |
|---|
| 10 | // =========================================================== // |
|---|
| 11 | |
|---|
| 12 | #ifndef ARB_ALGO_H |
|---|
| 13 | #define ARB_ALGO_H |
|---|
| 14 | |
|---|
| 15 | #ifndef _GLIBCXX_ALGORITHM |
|---|
| 16 | #include <algorithm> |
|---|
| 17 | #endif |
|---|
| 18 | |
|---|
| 19 | template <typename T> |
|---|
| 20 | CONSTEXPR_INLINE const T& force_in_range(const T& lower_bound, const T& value, const T& upper_bound) { |
|---|
| 21 | return std::min(std::max(lower_bound, value), upper_bound); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | #else |
|---|
| 25 | #error arb_algo.h included twice |
|---|
| 26 | #endif // ARB_ALGO_H |
|---|
Note: See
TracBrowser
for help on using the repository browser.