qxLib
between.h
Go to the documentation of this file.
1 /**
2 
3  @file between.h
4  @author Khrapov
5  @date 25.09.2025
6  @copyright © Nick Khrapov, 2025. All right reserved.
7 
8 **/
9 #pragma once
10 
12 #include <qx/math/float_compare.h>
13 
14 namespace qx
15 {
16 
17 /**
18  @brief Checks if value is between left and right
19  @details Overloading for disabling 4388 warning with Compare instantiation
20  @tparam T - value type
21  @tparam compare_t - comparator type
22  @param left - left value
23  @param value - value
24  @param right - right value
25  @retval - true, left <= value <= right
26 **/
27 template<class T, class compare_t = std::less_equal<>>
28 constexpr bool between(T left, T value, T right);
29 
30 /**
31  @brief Checks if value is between left and right
32  @tparam T - value type
33  @tparam compare_t - comparator type
34  @param left - left value
35  @param value - value
36  @param right - right value
37  @param compare - comparator function
38  @retval - true, left <= value <= right
39 **/
40 template<class T, class compare_t = std::less_equal<>>
41 constexpr bool between(T left, T value, T right, compare_t compare);
42 
43 } // namespace qx
44 
45 #include <qx/math/between.inl>
constexpr bool between(T left, T value, T right)
Checks if value is between left and right.
Definition: between.inl:43