Blaze
3.9
Toggle main menu visibility
Loading...
Searching...
No Matches
blaze
math
shims
Digits.h
Go to the documentation of this file.
1
//=================================================================================================
33
//=================================================================================================
34
35
#ifndef _BLAZE_MATH_SHIMS_DIGITS_H_
36
#define _BLAZE_MATH_SHIMS_DIGITS_H_
37
38
39
//*************************************************************************************************
40
// Includes
41
//*************************************************************************************************
42
43
#include <
blaze/util/EnableIf.h
>
44
#include <
blaze/util/Types.h
>
45
#include <
blaze/util/typetraits/IsIntegral.h
>
46
47
48
namespace
blaze {
49
50
//=================================================================================================
51
//
52
// DIGITS SHIM
53
//
54
//=================================================================================================
55
56
//*************************************************************************************************
74
template
<
typename
T
75
,
EnableIf_t< IsIntegral_v<T>
>* =
nullptr
>
76
constexpr
size_t
digits
( T a )
noexcept
77
{
78
size_t
count( 0 );
79
80
while
( a != 0 ) {
81
a /= 10;
82
++count;
83
}
84
85
return
count;
86
}
87
//*************************************************************************************************
88
89
}
// namespace blaze
90
91
#endif
EnableIf.h
Header file for the EnableIf class template.
IsIntegral.h
Header file for the IsIntegral type trait.
blaze::digits
constexpr size_t digits(T a) noexcept
Returns the number of valid digits of an integral value.
Definition
Digits.h:76
blaze::EnableIf_t
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition
EnableIf.h:138
Types.h
Header file for basic type definitions.
Generated by
1.18.0