Blaze  3.6
Min.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_ALGORITHMS_MIN_H_
36 #define _BLAZE_UTIL_ALGORITHMS_MIN_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/system/Inline.h>
44 #include <blaze/util/EnableIf.h>
47 
48 
49 namespace blaze {
50 
51 //=================================================================================================
52 //
53 // MIN ALGORITHMS
54 //
55 //=================================================================================================
56 
57 //*************************************************************************************************
68 template< typename T1, typename T2
69  , typename = EnableIf_t< ( IsSigned_v<T1> && IsSigned_v<T2> ) ||
70  ( IsUnsigned_v<T1> && IsUnsigned_v<T2> ) > >
71 BLAZE_ALWAYS_INLINE constexpr auto
72  min( const T1& a, const T2& b ) noexcept
73 {
74  return ( a < b )?( a ):( b );
75 }
76 //*************************************************************************************************
77 
78 
79 //*************************************************************************************************
91 template< typename T1, typename T2, typename T3 >
92 BLAZE_ALWAYS_INLINE constexpr decltype(auto)
93  min( const T1& a, const T2& b, const T3& c ) noexcept
94 {
95  using blaze::min;
96 
97  return min( min( a, b ), c );
98 }
99 //*************************************************************************************************
100 
101 
102 //*************************************************************************************************
115 template< typename T1, typename T2, typename T3, typename... Ts >
116 BLAZE_ALWAYS_INLINE constexpr decltype(auto)
117  min( const T1& a, const T2& b, const T3& c, const Ts&... args ) noexcept
118 {
119  using blaze::min;
120 
121  return min( min( min( a, b ), c ), args... );
122 }
123 //*************************************************************************************************
124 
125 } // namespace blaze
126 
127 #endif
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
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
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
Header file for the EnableIf class template.
Header file for the IsSigned type trait.
Header file for the IsUnsigned type trait.
System settings for the inline keywords.