Blaze  3.6
Less.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SHIMS_LESS_H_
36 #define _BLAZE_MATH_SHIMS_LESS_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/system/Inline.h>
46 
47 
48 namespace blaze {
49 
50 //=================================================================================================
51 //
52 // LESS SHIM
53 //
54 //=================================================================================================
55 
56 //*************************************************************************************************
67 template< typename T >
68 BLAZE_ALWAYS_INLINE constexpr bool less_backend( const T& a, const T& b )
69  noexcept( IsBuiltin_v<T> )
70 {
71  return a < b;
72 }
74 //*************************************************************************************************
75 
76 
77 //*************************************************************************************************
91 BLAZE_ALWAYS_INLINE constexpr bool less_backend( float a, float b ) noexcept
92 {
93  return ( b - a ) > 1E-8F;
94 }
96 //*************************************************************************************************
97 
98 
99 //*************************************************************************************************
113 BLAZE_ALWAYS_INLINE constexpr bool less_backend( double a, double b ) noexcept
114 {
115  return ( b - a ) > 1E-8;
116 }
118 //*************************************************************************************************
119 
120 
121 //*************************************************************************************************
135 BLAZE_ALWAYS_INLINE constexpr bool less_backend( long double a, long double b ) noexcept
136 {
137  return ( b - a ) > 1E-10;
138 }
140 //*************************************************************************************************
141 
142 
143 //*************************************************************************************************
155 template< typename T1, typename T2 >
156 BLAZE_ALWAYS_INLINE constexpr bool less( const T1& a, const T2& b )
157  noexcept( IsBuiltin_v< CommonType_t<T1,T2> > )
158 {
159  return less_backend< CommonType_t<T1,T2> >( a, b );
160 }
161 //*************************************************************************************************
162 
163 } // namespace blaze
164 
165 #endif
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
constexpr bool IsBuiltin_v
Auxiliary variable template for the IsBuiltin type trait.The IsBuiltin_v variable template provides a...
Definition: IsBuiltin.h:95
typename CommonType< T... >::Type CommonType_t
Auxiliary alias declaration for the CommonType type trait.The CommonType_t alias declaration provides...
Definition: CommonType.h:95
Header file for the CommonType type trait.
BLAZE_ALWAYS_INLINE constexpr bool less(const T1 &a, const T2 &b) noexcept(IsBuiltin_v< CommonType_t< T1, T2 > >)
Generic less-than comparison.
Definition: Less.h:156
Header file for the IsBuiltin type trait.
System settings for the inline keywords.