JayBeams
0.1
Another project to have fun coding.
jb
itch5
static_digits.hpp
Go to the documentation of this file.
1
#ifndef jb_itch5_static_digits_hpp
2
#define jb_itch5_static_digits_hpp
3
4
#include <cstdint>
5
6
namespace
jb
{
7
namespace
itch5 {
8
9
/// Compute (at compile time if possible) the number of digits in a
10
/// number.
11
constexpr
int
static_digits
(std::intmax_t value) {
12
return
value < 10 ? 1 : 1 +
static_digits
(value / 10);
13
}
14
15
}
// namespace itch5
16
}
// namespace jb
17
18
#endif // jb_itch5_static_digits_hpp
jb::itch5::static_digits
constexpr int static_digits(std::intmax_t value)
Compute (at compile time if possible) the number of digits in a number.
Definition:
static_digits.hpp:11
jb
The top-level namespace for the JayBeams library.
Definition:
as_hhmmss.hpp:7
Generated by
1.8.13