12#ifndef GMP_META_TO_FIXED_STRING_HPP_
13#define GMP_META_TO_FIXED_STRING_HPP_
22template<std::
intmax_t N>
23struct to_fixed_string_impl {
24 static constexpr auto value = []() {
25 constexpr auto buflen = []() {
26 unsigned int len = (N == 0) ? 1 : (N > 0 ? 1 : 2);
27 for (
auto n = N;
n;
len++,
n /= 10);
35 if constexpr (N != 0) {
36 auto n = N < 0 ? -N : N;
38 *--ptr =
"0123456789"[
n % 10];
55template<std::
intmax_t N>
static constexpr auto to_fixed_string_v
fixed_string(char const(&)[N]) -> fixed_string< N - 1 >
Deduce fixed_string length from a string literal.