Debian Codegraph @

third-party/boost-math/include/boost/math/ccmath/isless.hpp

raw
1 // (C) Copyright Matt Borland 2022.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef BOOST_MATH_CCMATH_ISLESS_HPP
7 #define BOOST_MATH_CCMATH_ISLESS_HPP
8
9 #include <boost/math/ccmath/detail/config.hpp>
10
11 #ifdef BOOST_MATH_NO_CCMATH
12 #error "The header <boost/math/isless.hpp> can only be used in C++17 and later."
13 #endif
14
15 #include <boost/math/ccmath/isnan.hpp>
16
17 namespace boost::math::ccmath {
18
19 template <typename T1, typename T2 = T1>
20 inline constexpr bool isless(T1 x, T2 y) noexcept
21 {
22 if (BOOST_MATH_IS_CONSTANT_EVALUATED(x))
23 {
24 if (boost::math::ccmath::isnan(x) || boost::math::ccmath::isnan(y))
25 {
26 return false;
27 }
28 else
29 {
30 return x < y;
31 }
32 }
33 else
34 {
35 using std::isless;
36 return isless(x, y);
37 }
38 }
39
40 } // Namespaces
41
42 #endif // BOOST_MATH_CCMATH_ISLESS_HPP