Blaze 3.9
IsOne.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_SHIMS_ISONE_H_
36#define _BLAZE_MATH_SHIMS_ISONE_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
45#include <blaze/system/Inline.h>
46#include <blaze/util/EnableIf.h>
49
50
51namespace blaze {
52
53//=================================================================================================
54//
55// ISONE SHIM
56//
57//=================================================================================================
58
59//*************************************************************************************************
103template< RelaxationFlag RF // Relaxation flag
104 , typename Type // Type of the given value/object
105 , EnableIf_t< IsNumeric_v<Type> >* = nullptr >
106BLAZE_ALWAYS_INLINE bool isOne( const Type& v ) noexcept
107{
108 return equal<RF>( v, Type(1) );
109}
110//*************************************************************************************************
111
112
113//*************************************************************************************************
121template< RelaxationFlag RF // Relaxation flag
122 , typename Type // Type of the given value/object
123 , DisableIf_t< IsNumeric_v<Type> >* = nullptr >
124BLAZE_ALWAYS_INLINE bool isOne( const Type& v ) noexcept
125{
126 MAYBE_UNUSED( v );
127
128 return false;
129}
131//*************************************************************************************************
132
133
134//*************************************************************************************************
178template< typename Type >
179BLAZE_ALWAYS_INLINE bool isOne( const Type& v )
180{
181 return isOne<relaxed>( v );
182}
183//*************************************************************************************************
184
185} // namespace blaze
186
187#endif
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
Header file for the MAYBE_UNUSED function template.
Header file for the relaxation flag enumeration.
BLAZE_ALWAYS_INLINE bool isOne(const Type &v)
Returns whether the given value/object represents the numeric value 1.
Definition: IsOne.h:179
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the equal shim.
System settings for the inline keywords.