46#ifdef __INTEL_COMPILER
47# define FMT_ICC_VERSION __INTEL_COMPILER
49# define FMT_ICC_VERSION __ICL
51# define FMT_ICC_VERSION 0
55# define FMT_CUDA_VERSION (__CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__)
57# define FMT_CUDA_VERSION 0
61# define FMT_HAS_BUILTIN(x) __has_builtin(x)
63# define FMT_HAS_BUILTIN(x) 0
66#if FMT_GCC_VERSION || FMT_CLANG_VERSION
67# define FMT_NOINLINE __attribute__((noinline))
73# define FMT_MSC_DEFAULT = default
75# define FMT_MSC_DEFAULT
80# if FMT_MSC_VER || FMT_NVCC
83template <
typename Exception>
inline void do_throw(
const Exception& x) {
86 volatile bool b =
true;
91# define FMT_THROW(x) detail::do_throw(x)
93# define FMT_THROW(x) throw x
96# define FMT_THROW(x) \
98 FMT_ASSERT(false, (x).what()); \
105# define FMT_CATCH(x) catch (x)
107# define FMT_TRY if (true)
108# define FMT_CATCH(x) if (false)
111#ifndef FMT_DEPRECATED
112# if FMT_HAS_CPP14_ATTRIBUTE(deprecated) || FMT_MSC_VER >= 1900
113# define FMT_DEPRECATED [[deprecated]]
115# if (defined(__GNUC__) && !defined(__LCC__)) || defined(__clang__)
116# define FMT_DEPRECATED __attribute__((deprecated))
118# define FMT_DEPRECATED __declspec(deprecated)
120# define FMT_DEPRECATED
126#if FMT_ICC_VERSION || defined(__PGI) || FMT_NVCC
127# define FMT_DEPRECATED_ALIAS
129# define FMT_DEPRECATED_ALIAS FMT_DEPRECATED
132#ifndef FMT_USE_USER_DEFINED_LITERALS
134# if (FMT_HAS_FEATURE(cxx_user_literals) || FMT_GCC_VERSION >= 407 || \
135 FMT_MSC_VER >= 1900) && \
136 (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 480)
137# define FMT_USE_USER_DEFINED_LITERALS 1
139# define FMT_USE_USER_DEFINED_LITERALS 0
147#if !defined(FMT_REDUCE_INT_INSTANTIATIONS)
148# define FMT_REDUCE_INT_INSTANTIATIONS 0
153#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_clz)) && !FMT_MSC_VER
154# define FMT_BUILTIN_CLZ(n) __builtin_clz(n)
156#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_clzll)) && !FMT_MSC_VER
157# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)
159#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_ctz))
160# define FMT_BUILTIN_CTZ(n) __builtin_ctz(n)
162#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_ctzll))
163# define FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n)
173#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(FMT_BUILTIN_CTZLL)
177# if !defined(__clang__)
178# pragma managed(push, off)
179# pragma intrinsic(_BitScanForward)
180# pragma intrinsic(_BitScanReverse)
182# pragma intrinsic(_BitScanForward64)
183# pragma intrinsic(_BitScanReverse64)
187inline auto clz(uint32_t x) ->
int {
189 _BitScanReverse(&r, x);
195 return 31 ^
static_cast<int>(r);
197# define FMT_BUILTIN_CLZ(n) detail::clz(n)
199inline auto clzll(uint64_t x) ->
int {
202 _BitScanReverse64(&r, x);
205 if (_BitScanReverse(&r,
static_cast<uint32_t
>(x >> 32)))
return 63 ^ (r + 32);
207 _BitScanReverse(&r,
static_cast<uint32_t
>(x));
211 return 63 ^
static_cast<int>(r);
213# define FMT_BUILTIN_CLZLL(n) detail::clzll(n)
215inline auto ctz(uint32_t x) ->
int {
217 _BitScanForward(&r, x);
220 return static_cast<int>(r);
222# define FMT_BUILTIN_CTZ(n) detail::ctz(n)
224inline auto ctzll(uint64_t x) ->
int {
229 _BitScanForward64(&r, x);
232 if (_BitScanForward(&r,
static_cast<uint32_t
>(x)))
return static_cast<int>(r);
234 _BitScanForward(&r,
static_cast<uint32_t
>(x >> 32));
237 return static_cast<int>(r);
239# define FMT_BUILTIN_CTZLL(n) detail::ctzll(n)
240# if !defined(__clang__)
250#if __cplusplus >= 202002L || \
251 (__cplusplus >= 201709L && FMT_GCC_VERSION >= 1002)
252# define FMT_CONSTEXPR20 constexpr
254# define FMT_CONSTEXPR20
260template <
typename Dest,
typename Source>
261inline auto bit_cast(
const Source& source) -> Dest {
262 static_assert(
sizeof(Dest) ==
sizeof(Source),
"size mismatch");
271 char data[
sizeof(u)];
273 return bit_cast<bytes>(u).data[0] == 0;
282 *
this = bit_cast<fallback_uintptr>(p);
284 for (
size_t i = 0, j =
sizeof(
void*) - 1; i < j; ++i, --j)
292 return bit_cast<uintptr_t>(p);
306template <
typename T>
constexpr auto num_bits() ->
int {
313 return static_cast<int>(
sizeof(
void*) *
319#if FMT_HAS_BUILTIN(__builtin_assume)
320 __builtin_assume(condition);
330template <
typename Char>
334template <
typename Container>
335inline auto get_data(Container& c) ->
typename Container::value_type* {
339#if defined(_SECURE_SCL) && _SECURE_SCL
341template <
typename T>
using checked_ptr = stdext::checked_array_iterator<T*>;
342template <
typename T>
auto make_checked(
T* p,
size_t size) -> checked_ptr<T> {
352template <
typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)>
353#if FMT_CLANG_VERSION >= 307 && !FMT_ICC_VERSION
354__attribute__((no_sanitize(
"undefined")))
360 size_t size = c.size();
368 buf.try_reserve(buf.size() + n);
372template <
typename Iterator>
373constexpr auto reserve(Iterator& it,
size_t) -> Iterator& {
377template <
typename OutputIt>
381template <
typename T,
typename OutputIt>
387 auto size = buf.size();
388 if (buf.capacity() < size + n)
return nullptr;
389 buf.try_resize(size + n);
390 return buf.data() + size;
393template <
typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)>
400template <
typename Iterator>
407template <
typename OutputIt,
typename Size,
typename T>
410 for (Size i = 0; i <
count; ++i) *out++ =
value;
413template <
typename T,
typename Size>
416 return fill_n<T*, Size, T>(out,
count,
value);
428template <
typename OutChar,
typename InputIt,
typename OutputIt>
430 OutputIt out) -> OutputIt {
431 return copy_str<OutChar>(begin, end, out);
453 constexpr const int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07};
454 constexpr const uint32_t mins[] = {4194304, 0, 128, 2048, 65536};
455 constexpr const int shiftc[] = {0, 18, 12, 6, 0};
456 constexpr const int shifte[] = {0, 6, 4, 2, 0};
459 const char* next = s + len;
463 *c = uint32_t(s[0] & masks[len]) << 18;
464 *c |= uint32_t(s[1] & 0x3f) << 12;
465 *c |= uint32_t(s[2] & 0x3f) << 6;
466 *c |= uint32_t(s[3] & 0x3f) << 0;
470 using uchar =
unsigned char;
471 *e = (*c < mins[len]) << 6;
472 *e |= ((*c >> 11) == 0x1b) << 7;
473 *e |= (*c > 0x10FFFF) << 8;
474 *e |= (uchar(s[1]) & 0xc0) >> 2;
475 *e |= (uchar(s[2]) & 0xc0) >> 4;
476 *e |= uchar(s[3]) >> 6;
485 auto decode = [f](
const char* p) {
486 auto cp = uint32_t();
493 const size_t block_size = 4;
494 if (s.
size() >= block_size) {
495 for (
auto end = p + s.
size() - block_size + 1; p < end;) p = decode(p);
497 if (
auto num_chars_left = s.
data() + s.
size() - p) {
498 char buf[2 * block_size - 1] = {};
499 copy_str<char>(p, p + num_chars_left, buf);
503 }
while (p - buf < num_chars_left);
507template <
typename Char>
514 size_t num_code_points = 0;
516 struct count_code_points {
518 FMT_CONSTEXPR void operator()(uint32_t cp,
int error)
const {
519 *
count += detail::to_unsigned(
521 (error == 0 && cp >= 0x1100 &&
526 (cp >= 0x2e80 && cp <= 0xa4cf && cp != 0x303f) ||
527 (cp >= 0xac00 && cp <= 0xd7a3) ||
528 (cp >= 0xf900 && cp <= 0xfaff) ||
529 (cp >= 0xfe10 && cp <= 0xfe19) ||
530 (cp >= 0xfe30 && cp <= 0xfe6f) ||
531 (cp >= 0xff00 && cp <= 0xff60) ||
532 (cp >= 0xffe0 && cp <= 0xffe6) ||
533 (cp >= 0x20000 && cp <= 0x2fffd) ||
534 (cp >= 0x30000 && cp <= 0x3fffd) ||
536 (cp >= 0x1f300 && cp <= 0x1f64f) ||
538 (cp >= 0x1f900 && cp <= 0x1f9ff))));
542 return num_code_points;
547 reinterpret_cast<const char*
>(s.data()), s.size()));
550template <
typename Char>
552 size_t size = s.size();
553 return n < size ? n : size;
560 size_t num_code_points = 0;
561 for (
size_t i = 0, size = s.size(); i != size; ++i) {
562 if ((
data[i] & 0xc0) != 0x80 && ++num_code_points > n)
return i;
569 sizeof(
T) <=
sizeof(
double)>;
571#ifndef FMT_USE_FULL_CACHE_DRAGONBOX
572# define FMT_USE_FULL_CACHE_DRAGONBOX 0
578 while (begin != end) {
580 try_reserve(size_ +
count);
581 auto free_cap = capacity_ - size_;
589template <
typename T,
typename Enable =
void>
633 T*
data = this->data();
654 T*
data = other.data();
655 size_t size = other.size(), capacity = other.capacity();
657 this->set(
store_, capacity);
661 this->set(
data, capacity);
664 other.set(other.
store_, 0);
701 void reserve(
size_t new_capacity) { this->try_reserve(new_capacity); }
705 template <
typename ContiguousRange>
706 void append(
const ContiguousRange& range) {
707 append(range.data(), range.data() + range.size());
711template <
typename T,
size_t SIZE,
typename Allocator>
717 size_t old_capacity = this->capacity();
718 size_t new_capacity = old_capacity + old_capacity / 2;
719 if (size > new_capacity)
721 else if (new_capacity > max_size)
722 new_capacity = size > max_size ? size : max_size;
723 T* old_data = this->
data();
729 this->set(new_data, new_capacity);
733 if (old_data != store_) alloc_.deallocate(old_data, old_capacity);
738template <
typename T,
size_t SIZE,
typename Allocator>
752 :
std::runtime_error(message) {}
768template <typename... Args, typename S, typename Char =
char_t<S>>
776 "passing views as lvalues is disallowed");
777 detail::check_format_string<Args...>(
fmt);
783#if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
784template <
typename Char,
size_t N>
struct fixed_string {
785 constexpr fixed_string(
const Char (&str)[N]) {
786 detail::copy_str<Char, const Char*, Char*>(
static_cast<const Char*
>(str),
794template <
typename Char,
size_t N>
801template <
typename Char>
804 return {s.
data(), s.size()};
825template <
typename T, FMT_ENABLE_IF(is_
signed<T>::value)>
829template <
typename T, FMT_ENABLE_IF(!is_
signed<T>::value)>
834template <
typename T, FMT_ENABLE_IF(std::is_
floating_po
int<T>::value)>
851#define FMT_POWERS_OF_10(factor) \
852 factor * 10, (factor)*100, (factor)*1000, (factor)*10000, (factor)*100000, \
853 (factor)*1000000, (factor)*10000000, (factor)*100000000, \
859 static const uint64_t log10_2_significand = 0x4d104d427de7fbcc;
862 FMT_API static constexpr const char digits[100][2] = {
863 {
'0',
'0'}, {
'0',
'1'}, {
'0',
'2'}, {
'0',
'3'}, {
'0',
'4'}, {
'0',
'5'},
864 {
'0',
'6'}, {
'0',
'7'}, {
'0',
'8'}, {
'0',
'9'}, {
'1',
'0'}, {
'1',
'1'},
865 {
'1',
'2'}, {
'1',
'3'}, {
'1',
'4'}, {
'1',
'5'}, {
'1',
'6'}, {
'1',
'7'},
866 {
'1',
'8'}, {
'1',
'9'}, {
'2',
'0'}, {
'2',
'1'}, {
'2',
'2'}, {
'2',
'3'},
867 {
'2',
'4'}, {
'2',
'5'}, {
'2',
'6'}, {
'2',
'7'}, {
'2',
'8'}, {
'2',
'9'},
868 {
'3',
'0'}, {
'3',
'1'}, {
'3',
'2'}, {
'3',
'3'}, {
'3',
'4'}, {
'3',
'5'},
869 {
'3',
'6'}, {
'3',
'7'}, {
'3',
'8'}, {
'3',
'9'}, {
'4',
'0'}, {
'4',
'1'},
870 {
'4',
'2'}, {
'4',
'3'}, {
'4',
'4'}, {
'4',
'5'}, {
'4',
'6'}, {
'4',
'7'},
871 {
'4',
'8'}, {
'4',
'9'}, {
'5',
'0'}, {
'5',
'1'}, {
'5',
'2'}, {
'5',
'3'},
872 {
'5',
'4'}, {
'5',
'5'}, {
'5',
'6'}, {
'5',
'7'}, {
'5',
'8'}, {
'5',
'9'},
873 {
'6',
'0'}, {
'6',
'1'}, {
'6',
'2'}, {
'6',
'3'}, {
'6',
'4'}, {
'6',
'5'},
874 {
'6',
'6'}, {
'6',
'7'}, {
'6',
'8'}, {
'6',
'9'}, {
'7',
'0'}, {
'7',
'1'},
875 {
'7',
'2'}, {
'7',
'3'}, {
'7',
'4'}, {
'7',
'5'}, {
'7',
'6'}, {
'7',
'7'},
876 {
'7',
'8'}, {
'7',
'9'}, {
'8',
'0'}, {
'8',
'1'}, {
'8',
'2'}, {
'8',
'3'},
877 {
'8',
'4'}, {
'8',
'5'}, {
'8',
'6'}, {
'8',
'7'}, {
'8',
'8'}, {
'8',
'9'},
878 {
'9',
'0'}, {
'9',
'1'}, {
'9',
'2'}, {
'9',
'3'}, {
'9',
'4'}, {
'9',
'5'},
879 {
'9',
'6'}, {
'9',
'7'}, {
'9',
'8'}, {
'9',
'9'}};
881 FMT_API static constexpr const char hex_digits[] =
"0123456789abcdef";
882 FMT_API static constexpr const char signs[4] = {0,
'-',
'+',
' '};
883 FMT_API static constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u |
'+',
885 FMT_API static constexpr const char left_padding_shifts[5] = {31, 31, 0, 1,
887 FMT_API static constexpr const char right_padding_shifts[5] = {0, 31, 0, 1,
905 if (n < 10)
return count;
906 if (n < 100)
return count + 1;
907 if (n < 1000)
return count + 2;
908 if (n < 10000)
return count + 3;
922#ifdef FMT_BUILTIN_CLZLL
926 constexpr uint16_t bsr2log10[] = {
927 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5,
928 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10,
929 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15,
930 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20};
932 constexpr const uint64_t zero_or_powers_of_10[] = {
934 10000000000000000000ULL};
935 return t - (n < zero_or_powers_of_10[t]);
942template <
int BITS,
typename UInt>
944#ifdef FMT_BUILTIN_CLZ
945 if (num_bits<UInt>() == 32)
946 return (
FMT_BUILTIN_CLZ(
static_cast<uint32_t
>(n) | 1) ^ 31) / BITS + 1;
951 }
while ((n >>= BITS) != 0);
962#define FMT_INC(T) (((sizeof(#T) - 1ull) << 32) - T)
963 static constexpr uint64_t table[] = {
981#ifdef FMT_BUILTIN_CLZ
984 return static_cast<int>((n +
inc) >> 32);
1005template <
typename Char>
1007template <
typename Char>
1010 return {result.grouping, Char(result.thousands_sep)};
1017template <
typename Char>
1020 return Char(decimal_point_impl<char>(loc));
1027template <
typename Char>
auto equal2(
const Char* lhs,
const char* rhs) ->
bool {
1028 return lhs[0] == Char(rhs[0]) && lhs[1] == Char(rhs[1]);
1030inline auto equal2(
const char* lhs,
const char* rhs) ->
bool {
1031 return memcmp(lhs, rhs, 2) == 0;
1035template <
typename Char>
void copy2(Char* dst,
const char* src) {
1036 *dst++ =
static_cast<Char
>(*src++);
1037 *dst =
static_cast<Char
>(*src);
1049template <
typename Char,
typename UInt>
1056 while (
value >= 10) {
1057 *--out =
static_cast<Char
>(
'0' +
value % 10);
1060 *--out =
static_cast<Char
>(
'0' +
value);
1063 while (
value >= 100) {
1072 *--out =
static_cast<Char
>(
'0' +
value);
1080template <
typename Char,
typename UInt,
typename Iterator,
1087 return {out, detail::copy_str_noinline<Char>(
buffer, end, out)};
1090template <
unsigned BASE_BITS,
typename Char,
typename UInt>
1092 bool upper =
false) -> Char* {
1100 }
while ((
value >>= BASE_BITS) != 0);
1104template <
unsigned BASE_BITS,
typename Char>
1106 bool =
false) -> Char* {
1108 int start = (num_digits + char_digits - 1) / char_digits - 1;
1109 if (
int start_digits = num_digits % char_digits) {
1113 for (; start >= 0; --start) {
1126template <
unsigned BASE_BITS,
typename Char,
typename It,
typename UInt>
1136 return detail::copy_str_noinline<Char>(
buffer,
buffer + num_digits, out);
1147 auto size() const ->
size_t {
return buffer_.size() - 1; }
1148 auto c_str() const -> const
wchar_t* {
return &buffer_[0]; }
1149 auto str() const ->
std::wstring {
return {&buffer_[0], size()}; }
1159 static const int significand_bits = 23;
1160 static const int exponent_bits = 8;
1161 static const int min_exponent = -126;
1162 static const int max_exponent = 127;
1163 static const int exponent_bias = -127;
1164 static const int decimal_digits = 9;
1165 static const int kappa = 1;
1166 static const int big_divisor = 100;
1167 static const int small_divisor = 10;
1168 static const int min_k = -31;
1169 static const int max_k = 46;
1170 static const int cache_bits = 64;
1171 static const int divisibility_check_by_5_threshold = 39;
1172 static const int case_fc_pm_half_lower_threshold = -1;
1173 static const int case_fc_pm_half_upper_threshold = 6;
1174 static const int case_fc_lower_threshold = -2;
1175 static const int case_fc_upper_threshold = 6;
1176 static const int case_shorter_interval_left_endpoint_lower_threshold = 2;
1177 static const int case_shorter_interval_left_endpoint_upper_threshold = 3;
1178 static const int shorter_interval_tie_lower_threshold = -35;
1179 static const int shorter_interval_tie_upper_threshold = -35;
1180 static const int max_trailing_zeros = 7;
1185 static const int significand_bits = 52;
1186 static const int exponent_bits = 11;
1187 static const int min_exponent = -1022;
1188 static const int max_exponent = 1023;
1189 static const int exponent_bias = -1023;
1190 static const int decimal_digits = 17;
1191 static const int kappa = 2;
1192 static const int big_divisor = 1000;
1193 static const int small_divisor = 100;
1194 static const int min_k = -292;
1195 static const int max_k = 326;
1196 static const int cache_bits = 128;
1197 static const int divisibility_check_by_5_threshold = 86;
1198 static const int case_fc_pm_half_lower_threshold = -2;
1199 static const int case_fc_pm_half_upper_threshold = 9;
1200 static const int case_fc_lower_threshold = -4;
1201 static const int case_fc_upper_threshold = 9;
1202 static const int case_shorter_interval_left_endpoint_lower_threshold = 2;
1203 static const int case_shorter_interval_left_endpoint_upper_threshold = 3;
1204 static const int shorter_interval_tie_lower_threshold = -77;
1205 static const int shorter_interval_tie_upper_threshold = -77;
1206 static const int max_trailing_zeros = 16;
1215template <
typename T>
1219template <
typename T>
1228template <
typename Char,
typename It>
1232 *it++ =
static_cast<Char
>(
'-');
1235 *it++ =
static_cast<Char
>(
'+');
1239 if (
exp >= 1000) *it++ =
static_cast<Char
>(top[0]);
1240 *it++ =
static_cast<Char
>(top[1]);
1244 *it++ =
static_cast<Char
>(d[0]);
1245 *it++ =
static_cast<Char
>(d[1]);
1249template <
typename T>
1254template <
typename T>
1260 return static_cast<double>(
value);
1263template <
typename OutputIt,
typename Char>
1266 auto fill_size =
fill.size();
1269 for (
size_t i = 0; i < n; ++i)
1270 it = copy_str<Char>(
data,
data + fill_size, it);
1281 size_t size,
size_t width, F&& f) -> OutputIt {
1284 size_t padding = spec_width > width ? spec_width - width : 0;
1287 size_t left_padding = padding >> shifts[specs.align];
1288 size_t right_padding = padding - left_padding;
1289 auto it = reserve(out, size + padding * specs.fill.size());
1290 if (left_padding != 0) it =
fill(it, left_padding, specs.fill);
1292 if (right_padding != 0) it =
fill(it, right_padding, specs.fill);
1293 return base_iterator(out, it);
1299 size_t size, F&& f) -> OutputIt {
1300 return write_padded<align>(out, specs, size, size, f);
1303template <align::type align = align::left,
typename Char,
typename OutputIt>
1307 return write_padded<align>(
1308 out, specs,
bytes.size(), [
bytes](reserve_iterator<OutputIt> it) {
1309 const char* data = bytes.data();
1310 return copy_str<Char>(data, data + bytes.size(), it);
1314template <
typename Char,
typename OutputIt,
typename UIntPtr>
1319 auto write = [=](reserve_iterator<OutputIt> it) {
1320 *it++ =
static_cast<Char
>(
'0');
1321 *it++ =
static_cast<Char
>(
'x');
1322 return format_uint<4, Char>(it,
value, num_digits);
1324 return specs ? write_padded<align::right>(out, *specs, size,
write)
1325 : base_iterator(out,
write(reserve(out, size)));
1328template <
typename Char,
typename OutputIt>
1332 return write_padded(out, specs, 1, [=](reserve_iterator<OutputIt> it) {
1337template <
typename Char,
typename OutputIt>
1354 : size((prefix >> 24) +
to_unsigned(num_digits)), padding(0) {
1358 padding = width - size;
1361 }
else if (specs.
precision > num_digits) {
1372template <
typename OutputIt,
typename Char,
typename W>
1376 W write_digits) -> OutputIt {
1379 auto it = reserve(out,
to_unsigned(num_digits) + (prefix >> 24));
1381 for (
unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
1382 *it++ =
static_cast<Char
>(p & 0xff);
1384 return base_iterator(out, write_digits(it));
1387 return write_padded<align::right>(
1388 out, specs,
data.size, [=](reserve_iterator<OutputIt> it) {
1389 for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
1390 *it++ = static_cast<Char>(p & 0xff);
1391 it = detail::fill_n(it, data.padding, static_cast<Char>(
'0'));
1392 return write_digits(it);
1396template <
typename OutputIt,
typename UInt,
typename Char>
1401 const auto sep_size = 1;
1402 auto ts = thousands_sep<Char>(loc);
1403 if (!ts.thousands_sep)
return false;
1405 int size = num_digits, n = num_digits;
1407 std::string::const_iterator group = groups.
cbegin();
1408 while (group != groups.
cend() && n > *group && *group > 0 &&
1409 *group != max_value<char>()) {
1414 if (group == groups.
cend()) size += sep_size * ((n - 1) / groups.
back());
1418 if (prefix != 0) ++size;
1423 int digit_index = 0;
1426 for (
int i = num_digits - 1; i > 0; --i) {
1427 *p-- =
static_cast<Char
>(digits[i]);
1428 if (*group <= 0 || ++digit_index % *group != 0 ||
1429 *group == max_value<char>())
1431 if (group + 1 != groups.
cend()) {
1436 make_checked(p, s.
size()));
1439 *p-- =
static_cast<Char
>(*digits);
1440 if (prefix != 0) *p =
static_cast<Char
>(prefix);
1442 out = write_padded<align::right>(
1443 out, specs, usize, usize, [=](reserve_iterator<OutputIt> it) {
1444 return copy_str<Char>(
data,
data + size, it);
1451 prefix += (1u + (
value > 0xff ? 1 : 0)) << 24;
1459template <
typename T>
1465 prefix = 0x01000000 |
'-';
1466 abs_value = 0 - abs_value;
1470 return {abs_value, prefix};
1473template <
typename Char,
typename OutputIt,
typename T>
1479 auto prefix =
arg.prefix;
1480 auto utype =
static_cast<unsigned>(specs.
type);
1481 switch (specs.
type) {
1486 prefix, specs, loc)) {
1491 out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {
1492 return format_decimal<Char>(it, abs_value, num_digits).end;
1498 bool upper = specs.
type !=
'x';
1501 out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {
1502 return format_uint<4, Char>(it, abs_value, num_digits, upper);
1508 int num_digits = count_digits<1>(abs_value);
1509 return write_int(out, num_digits, prefix, specs,
1510 [=](reserve_iterator<OutputIt> it) {
1511 return format_uint<1, Char>(it, abs_value, num_digits);
1515 int num_digits = count_digits<3>(abs_value);
1516 if (specs.
alt && specs.
precision <= num_digits && abs_value != 0) {
1521 return write_int(out, num_digits, prefix, specs,
1522 [=](reserve_iterator<OutputIt> it) {
1523 return format_uint<3, Char>(it, abs_value, num_digits);
1527 return write_char(out,
static_cast<Char
>(abs_value), specs);
1533template <
typename Char,
typename OutputIt,
typename T,
1543template <
typename Char,
typename OutputIt,
typename T,
1553template <
typename Char,
typename OutputIt>
1556 auto data = s.data();
1557 auto size = s.size();
1563 [=](reserve_iterator<OutputIt> it) {
1564 return copy_str<Char>(
data,
data + size, it);
1567template <
typename Char,
typename OutputIt>
1573 return write(out, s, specs);
1575template <
typename Char,
typename OutputIt>
1581 : write_ptr<Char>(out, to_uintptr(s), &specs);
1584template <
typename Char,
typename OutputIt>
1588 isinf ? (fspecs.upper ?
"INF" :
"inf") : (fspecs.upper ?
"NAN" :
"nan");
1589 constexpr size_t str_size = 3;
1590 auto sign = fspecs.sign;
1591 auto size = str_size + (
sign ? 1 : 0);
1593 const bool is_zero_fill =
1594 specs.
fill.size() == 1 && *specs.
fill.data() ==
static_cast<Char
>(
'0');
1595 if (is_zero_fill) specs.
fill[0] =
static_cast<Char
>(
' ');
1596 return write_padded(out, specs, size, [=](reserve_iterator<OutputIt> it) {
1598 return copy_str<Char>(str, str + str_size, it);
1610 return fp.significand_size;
1612template <
typename T>
1617template <
typename Char,
typename OutputIt>
1619 int& significand_size) -> OutputIt {
1620 return copy_str<Char>(significand, significand + significand_size, out);
1622template <
typename Char,
typename OutputIt,
typename UInt>
1624 int significand_size) -> OutputIt {
1625 return format_decimal<Char>(out, significand, significand_size).end;
1628template <
typename Char,
typename UInt,
1634 auto end =
format_decimal(out + 1, significand, significand_size).end;
1635 if (integral_size == 1) {
1645template <
typename OutputIt,
typename UInt,
typename Char,
1648 int significand_size,
int integral_size,
1651 Char
buffer[digits10<UInt>() + 2];
1654 return detail::copy_str_noinline<Char>(
buffer, end, out);
1657template <
typename OutputIt,
typename Char>
1659 int significand_size,
int integral_size,
1661 out = detail::copy_str_noinline<Char>(significand,
1662 significand + integral_size, out);
1665 return detail::copy_str_noinline<Char>(significand + integral_size,
1666 significand + significand_size, out);
1669template <
typename OutputIt,
typename DecimalFP,
typename Char>
1673 auto significand = fp.significand;
1675 static const Char zero =
static_cast<Char
>(
'0');
1676 auto sign = fspecs.sign;
1678 using iterator = reserve_iterator<OutputIt>;
1680 int output_exp = fp.exponent + significand_size - 1;
1681 auto use_exp_format = [=]() {
1686 const int exp_lower = -4, exp_upper = 16;
1687 return output_exp < exp_lower ||
1688 output_exp >= (fspecs.precision > 0 ? fspecs.precision : exp_upper);
1690 if (use_exp_format()) {
1692 if (fspecs.showpoint) {
1693 num_zeros = fspecs.precision - significand_size;
1694 if (num_zeros < 0) num_zeros = 0;
1696 }
else if (significand_size == 1) {
1699 auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp;
1701 if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3;
1704 char exp_char = fspecs.upper ?
'E' :
'e';
1705 auto write = [=](iterator it) {
1711 *it++ =
static_cast<Char
>(exp_char);
1712 return write_exponent<Char>(output_exp, it);
1714 return specs.
width > 0 ? write_padded<align::right>(out, specs, size,
write)
1715 : base_iterator(out,
write(reserve(out, size)));
1718 int exp = fp.exponent + significand_size;
1719 if (fp.exponent >= 0) {
1722 int num_zeros = fspecs.precision -
exp;
1724 if (num_zeros > 5000)
1727 if (fspecs.showpoint) {
1729 if (num_zeros > 0) size +=
to_unsigned(num_zeros) + 1;
1731 return write_padded<align::right>(out, specs, size, [&](iterator it) {
1733 it = write_significand<Char>(it, significand, significand_size);
1735 if (!fspecs.showpoint)
return it;
1739 }
else if (
exp > 0) {
1741 int num_zeros = fspecs.showpoint ? fspecs.precision - significand_size : 0;
1742 size += 1 +
to_unsigned(num_zeros > 0 ? num_zeros : 0);
1743 return write_padded<align::right>(out, specs, size, [&](iterator it) {
1751 int num_zeros = -
exp;
1752 if (significand_size == 0 && fspecs.precision >= 0 &&
1753 fspecs.precision < num_zeros) {
1754 num_zeros = fspecs.precision;
1756 bool pointy = num_zeros != 0 || significand_size != 0 || fspecs.showpoint;
1757 size += 1 + (pointy ? 1 : 0) +
to_unsigned(num_zeros);
1758 return write_padded<align::right>(out, specs, size, [&](iterator it) {
1761 if (!pointy)
return it;
1764 return write_significand<Char>(it, significand, significand_size);
1768template <
typename Char,
typename OutputIt,
typename T,
1802 if (precision == max_value<int>())
1812 fspecs.
locale ? decimal_point<Char>(loc) : static_cast<Char>(
'.');
1814 return write_float(out, fp, specs, fspecs, point);
1817template <
typename Char,
typename OutputIt,
typename T,
1824 auto bits = bit_cast<uint>(
value);
1827 auto sign_bit = bits & (uint(1) << (num_bits<uint>() - 1));
1828 if (sign_bit != 0) {
1834 uint mask = exponent_mask<floaty>();
1835 if ((bits & mask) == mask)
1839 return write_float(out, dec, specs, fspecs,
static_cast<Char
>(
'.'));
1842template <
typename Char,
typename OutputIt,
typename T,
1844 !is_fast_float<T>::value)>
1845inline auto write(OutputIt out,
T value) -> OutputIt {
1849template <
typename Char,
typename OutputIt>
1856template <
typename Char,
typename OutputIt>
1859 auto it = reserve(out,
value.size());
1860 it = copy_str_noinline<Char>(
value.begin(),
value.end(), it);
1861 return base_iterator(out, it);
1864template <
typename Char,
typename OutputIt,
typename T,
1867 return write<Char>(out, to_string_view(
value));
1870template <
typename Char,
typename OutputIt,
typename T,
1878 if (negative) abs_value = ~abs_value + 1;
1880 auto size = (negative ? 1 : 0) +
static_cast<size_t>(num_digits);
1881 auto it = reserve(out, size);
1882 if (
auto ptr = to_pointer<Char>(it, size)) {
1883 if (negative) *
ptr++ =
static_cast<Char
>(
'-');
1884 format_decimal<Char>(
ptr, abs_value, num_digits);
1887 if (negative) *it++ =
static_cast<Char
>(
'-');
1888 it = format_decimal<Char>(it, abs_value, num_digits).end;
1889 return base_iterator(out, it);
1894 typename Char,
typename OutputIt,
typename T,
1905template <
typename Char,
typename OutputIt,
typename T,
1910 return specs.
type && specs.
type !=
's'
1915template <
typename Char,
typename OutputIt>
1917 auto it = reserve(out, 1);
1919 return base_iterator(out, it);
1922template <
typename Char,
typename OutputIt>
1934template <
typename Char,
typename OutputIt,
typename T,
1943template <
typename Char,
typename OutputIt,
typename T>
1950 using formatter_type =
1952 typename context_type::template formatter_type<T>,
1954 context_type ctx(out, {}, {});
1955 return formatter_type().format(
value, ctx);
1969 return write<Char>(out,
value);
1973 context format_ctx(out, args, loc);
1974 h.format(parse_ctx, format_ctx);
1975 return format_ctx.out();
1987 template <
typename T>
2004 h.format(parse_ctx, ctx);
2009template <
typename T>
2019 template <
typename T, FMT_ENABLE_IF(is_
integer<T>::value)>
2022 return static_cast<unsigned long long>(
value);
2025 template <
typename T, FMT_ENABLE_IF(!is_
integer<T>::value)>
2027 handler_.on_error(
"width is not integer");
2039 template <
typename T, FMT_ENABLE_IF(is_
integer<T>::value)>
2042 return static_cast<unsigned long long>(
value);
2045 template <
typename T, FMT_ENABLE_IF(!is_
integer<T>::value)>
2047 handler_.on_error(
"precision is not integer");
2055template <
template <
typename>
class Handler,
typename FormatArg,
2056 typename ErrorHandler>
2059 if (
value >
to_unsigned(max_value<int>())) eh.on_error(
"number is too big");
2060 return static_cast<int>(
value);
2063template <
typename Context,
typename ID>
2065 typename Context::format_arg {
2066 auto arg = ctx.arg(
id);
2067 if (!
arg) ctx.on_error(
"argument not found");
2081 return detail::get_arg(context_, parse_context_.
next_arg_id());
2086 return detail::get_arg(context_, arg_id);
2091 return detail::get_arg(context_, arg_id);
2098 :
specs_setter<Char>(specs), parse_context_(parse_ctx), context_(ctx) {}
2101 this->specs_.width = get_dynamic_spec<width_checker>(
2106 this->specs_.precision = get_dynamic_spec<precision_checker>(
2113template <
template <
typename>
class Handler,
typename Context>
2121 value = detail::get_dynamic_spec<Handler>(ctx.arg(ref.val.index),
2122 ctx.error_handler());
2125 value = detail::get_dynamic_spec<Handler>(ctx.arg(ref.val.name),
2126 ctx.error_handler());
2131#define FMT_STRING_IMPL(s, base, explicit) \
2135 struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base { \
2136 using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
2137 FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit \
2138 operator fmt::basic_string_view<char_type>() const { \
2139 return fmt::detail_exported::compile_string_to_view<char_type>(s); \
2142 return FMT_COMPILE_STRING(); \
2155#define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::compile_string, )
2157#if FMT_USE_USER_DEFINED_LITERALS
2158template <
typename Char>
struct udl_formatter {
2161 template <
typename...
T>
2163 return vformat(str, fmt::make_args_checked<T...>(str, args...));
2167# if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
2168template <
typename T,
typename Char,
size_t N,
2169 fmt::detail_exported::fixed_string<Char, N> Str>
2170struct statically_named_arg :
view {
2171 static constexpr auto name = Str.data;
2174 statically_named_arg(
const T& v) :
value(v) {}
2177template <
typename T,
typename Char,
size_t N,
2178 fmt::detail_exported::fixed_string<Char, N> Str>
2181template <
typename T,
typename Char,
size_t N,
2182 fmt::detail_exported::fixed_string<Char, N> Str>
2186template <
typename Char,
size_t N,
2187 fmt::detail_exported::fixed_string<Char, N> Str>
2189 template <
typename T>
auto operator=(
T&&
value)
const {
2194template <
typename Char>
struct udl_arg {
2204template <
typename Locale,
typename Char>
2209 detail::vformat_to(
buffer, format_str, args, detail::locale_ref(loc));
2242template <
typename...
T>
2278 mutable char buffer_[buffer_size];
2282 auto n =
static_cast<detail::uint32_or_64_or_128_t<UInt>
>(
value);
2283 return detail::format_decimal(buffer_, n, buffer_size - 1).begin;
2287 auto abs_value =
static_cast<detail::uint32_or_64_or_128_t<Int>
>(
value);
2288 bool negative =
value < 0;
2289 if (negative) abs_value = 0 - abs_value;
2290 auto begin = format_unsigned(abs_value);
2291 if (negative) *--begin =
'-';
2302 : str_(format_unsigned(
value)) {}
2306 return detail::to_unsigned(buffer_ - str_ + buffer_size - 1);
2313 auto data() const -> const
char* {
return str_; }
2320 buffer_[buffer_size - 1] =
'\0';
2332template <
typename T,
typename Char>
2333template <
typename FormatContext>
2336 enable_if_t<detail::type_constant<T, Char>::value !=
2339 const ->
decltype(ctx.out()) {
2340 if (specs_.width_ref.kind != detail::arg_id_kind::none ||
2341 specs_.precision_ref.kind != detail::arg_id_kind::none) {
2342 auto specs = specs_;
2343 detail::handle_dynamic_spec<detail::width_checker>(specs.
width,
2344 specs.width_ref, ctx);
2345 detail::handle_dynamic_spec<detail::precision_checker>(
2346 specs.
precision, specs.precision_ref, ctx);
2347 return detail::write<Char>(ctx.out(), val, specs, ctx.locale());
2349 return detail::write<Char>(ctx.out(), val, specs_, ctx.locale());
2352#define FMT_FORMAT_AS(Type, Base) \
2353 template <typename Char> \
2354 struct formatter<Type, Char> : formatter<Base, Char> { \
2355 template <typename FormatContext> \
2356 auto format(Type const& val, FormatContext& ctx) const \
2357 -> decltype(ctx.out()) { \
2358 return formatter<Base, Char>::format(static_cast<Base>(val), ctx); \
2373template <
typename Char>
2375 template <
typename FormatContext>
2376 auto format(
void* val, FormatContext& ctx)
const ->
decltype(ctx.out()) {
2381template <
typename Char,
size_t N>
2383 template <
typename FormatContext>
2385 ->
decltype(ctx.out()) {
2414 detail::handle_dynamic_spec<detail::width_checker>(specs_.width,
2415 specs_.width_ref, ctx);
2416 detail::handle_dynamic_spec<detail::precision_checker>(
2417 specs_.precision, specs_.precision_ref, ctx);
2421 template <
typename ParseContext>
2423 format_str_ = ctx.begin();
2425 detail::dynamic_specs_handler<ParseContext> handler(specs_, ctx);
2426 return detail::parse_format_specs(ctx.begin(), ctx.end(), handler);
2429 template <
typename T,
typename FormatContext>
2430 auto format(
const T& val, FormatContext& ctx) ->
decltype(ctx.out()) {
2432 detail::specs_checker<null_handler> checker(
2433 null_handler(), detail::mapped_type_constant<T, FormatContext>::value);
2434 checker.on_align(specs_.align);
2435 if (specs_.sign !=
sign::none) checker.on_sign(specs_.sign);
2436 if (specs_.alt) checker.on_hash();
2437 if (specs_.precision >= 0) checker.end_precision();
2438 return detail::write<Char>(ctx.out(), val, specs_, ctx.locale());
2451template <
typename T>
auto ptr(
T p) ->
const void* {
2453 return detail::bit_cast<const void*>(p);
2476 template <
typename ParseContext>
2478 using handler_type = detail::dynamic_specs_handler<ParseContext>;
2479 detail::specs_checker<handler_type> handler(handler_type(specs_, ctx),
2480 detail::type::string_type);
2482 detail::check_string_type_spec(specs_.type, ctx.error_handler());
2486 template <
typename FormatContext>
2488 detail::handle_dynamic_spec<detail::width_checker>(specs_.width,
2489 specs_.width_ref, ctx);
2490 detail::handle_dynamic_spec<detail::precision_checker>(
2491 specs_.precision, specs_.precision_ref, ctx);
2492 return detail::write_bytes(ctx.out(), b.data_, specs_);
2496template <
typename It,
typename Sentinel,
typename Char =
char>
2503 : begin(b), end(e), sep(s) {}
2506template <
typename It,
typename Sentinel,
typename Char>
2509template <
typename It,
typename Sentinel,
typename Char>
2516 template <
typename T, FMT_ENABLE_IF(has_formatter<T, context>::value)>
2520 template <
typename T, FMT_ENABLE_IF(!has_formatter<T, context>::value)>
2530 detail::fallback_formatter<value_type, Char>>;
2535 template <
typename ParseContext>
2537 return value_formatter_.parse(ctx);
2540 template <
typename FormatContext>
2542 ->
decltype(ctx.out()) {
2543 auto it =
value.begin;
2544 auto out = ctx.out();
2545 if (it !=
value.end) {
2546 out = value_formatter_.format(map(*it++), ctx);
2547 while (it !=
value.end) {
2548 out = detail::copy_str<Char>(
value.sep.begin(),
value.sep.end(), out);
2549 ctx.advance_to(out);
2550 out = value_formatter_.format(map(*it++), ctx);
2561template <
typename It,
typename Sentinel>
2563 return {begin, end, sep};
2582template <
typename Range>
2599template <
typename T, FMT_ENABLE_IF(!std::is_
integral<T>::value)>
2606template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
2610 constexpr int max_size = detail::digits10<T>() + 2;
2611 char buffer[max_size > 5 ?
static_cast<unsigned>(max_size) : 5];
2616template <
typename Char,
size_t SIZE>
2619 auto size = buf.size();
2626template <
typename Char>
2633 using detail::arg_formatter;
2634 using detail::buffer_appender;
2635 using detail::custom_formatter;
2636 using detail::default_arg_formatter;
2637 using detail::get_arg;
2638 using detail::locale_ref;
2639 using detail::parse_format_specs;
2640 using detail::specs_checker;
2641 using detail::specs_handler;
2642 using detail::to_unsigned;
2647 auto arg = args.get(0);
2659 : parse_context(str), context(out, args, loc) {}
2661 void on_text(
const Char* begin,
const Char* end) {
2673 int arg_id = context.
arg_id(
id);
2674 if (arg_id < 0) on_error(
"argument not found");
2678 FMT_INLINE void on_replacement_field(
int id,
const Char*) {
2686 auto on_format_specs(
int id,
const Char* begin,
const Char* end)
2691 (begin - &*parse_context.
begin()));
2693 return parse_context.
begin();
2699 if (begin == end || *begin !=
'}')
2700 on_error(
"missing '}' in format string");
2706 detail::parse_format_string<false>(
fmt, format_handler(out,
fmt, args, loc));
2709#ifndef FMT_HEADER_ONLY
2734#if FMT_USE_USER_DEFINED_LITERALS
2746# if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
2747template <detail_exported::fixed_
string Str>
2748constexpr auto operator""_a()
2750 sizeof(Str.data) /
sizeof(
decltype(Str.data[0])), Str> {
2754constexpr auto operator"" _a(
const char* s,
size_t) -> detail::udl_arg<char> {
2769constexpr auto operator"" _format(
const char* s,
size_t n)
2770 -> detail::udl_formatter<char> {
2776template <
typename Locale, FMT_ENABLE_IF(detail::is_locale<Locale>::value)>
2779 return detail::vformat(loc,
fmt, args);
2782template <
typename Locale,
typename...
T,
2789template <
typename...
T,
size_t SIZE,
typename Allocator>
2793 detail::vformat_to(buf,
string_view(
fmt), fmt::make_format_args(args...));
2797template <
typename OutputIt,
typename Locale,
2798 FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value&&
2802 using detail::get_buffer;
2803 auto&& buf = get_buffer<char>(out);
2804 detail::vformat_to(buf,
fmt, args, detail::locale_ref(loc));
2805 return detail::get_iterator(buf);
2808template <
typename OutputIt,
typename Locale,
typename...
T,
2809 FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value&&
2813 return vformat_to(out, loc,
fmt, fmt::make_format_args(args...));
2819#ifdef FMT_DEPRECATED_INCLUDE_XCHAR
2823#ifdef FMT_HEADER_ONLY
2824# define FMT_FUNC inline
T back_inserter(T... args)
FMT_CONSTEXPR auto locale() -> detail::locale_ref
FMT_CONSTEXPR auto out() -> iterator
FMT_CONSTEXPR auto arg_id(basic_string_view< char_type > name) -> int
void on_error(const char *message)
FMT_CONSTEXPR auto error_handler() -> detail::error_handler
auto args() const -> const basic_format_args< basic_format_context > &
void advance_to(iterator it)
FMT_CONSTEXPR void check_arg_id(int)
FMT_CONSTEXPR auto next_arg_id() -> int
FMT_CONSTEXPR void advance_to(iterator it)
constexpr auto begin() const FMT_NOEXCEPT -> iterator
const T & const_reference
void reserve(size_t new_capacity)
void move(basic_memory_buffer &other)
auto get_allocator() const -> Allocator
void grow(size_t size) final FMT_OVERRIDE
auto operator=(basic_memory_buffer &&other) FMT_NOEXCEPT -> basic_memory_buffer &
void append(const ContiguousRange &range)
void resize(size_t count)
basic_memory_buffer(basic_memory_buffer &&other) FMT_NOEXCEPT
basic_memory_buffer(const Allocator &alloc=Allocator())
constexpr auto data() const -> const Char *
constexpr auto size() const -> size_t
void append(const U *begin, const U *end)
auto size() const FMT_NOEXCEPT -> size_t
void push_back(const T &value)
auto data() FMT_NOEXCEPT -> T *
FMT_CONSTEXPR auto operator()(T) -> unsigned long long
FMT_CONSTEXPR precision_checker(ErrorHandler &eh)
FMT_CONSTEXPR auto operator()(T value) -> unsigned long long
buffer_context< Char > & context_
basic_format_parse_context< Char > & parse_context_
FMT_CONSTEXPR auto get_arg(basic_string_view< Char > arg_id) -> format_arg
FMT_CONSTEXPR void on_dynamic_width(Id arg_id)
void on_error(const char *message)
FMT_CONSTEXPR specs_handler(basic_format_specs< Char > &specs, basic_format_parse_context< Char > &parse_ctx, buffer_context< Char > &ctx)
FMT_CONSTEXPR void on_dynamic_precision(Id arg_id)
FMT_CONSTEXPR auto get_arg(int arg_id) -> format_arg
FMT_CONSTEXPR auto get_arg(auto_id) -> format_arg
auto str() const -> std::wstring
auto size() const -> size_t
auto c_str() const -> const wchar_t *
basic_memory_buffer< wchar_t > buffer_
constexpr FMT_INLINE value()
FMT_CONSTEXPR auto operator()(T) -> unsigned long long
FMT_CONSTEXPR auto operator()(T value) -> unsigned long long
FMT_CONSTEXPR width_checker(ErrorHandler &eh)
auto format_to(OutputIt out, const text_style &ts, const S &format_str, Args &&... args) -> typename std::enable_if< enable, OutputIt >::type
void vformat_to(buffer< Char > &buf, const text_style &ts, basic_string_view< Char > format_str, basic_format_args< buffer_context< type_identity_t< Char > > > args)
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
std::basic_string< Char > vformat(const text_style &ts, const S &format_str, basic_format_args< buffer_context< type_identity_t< Char > > > args)
#define FMT_ASSERT(condition, message)
FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg) -> decltype(vis(0))
FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(const Char *begin, const Char *end, SpecHandler &&handler) -> const Char *
FMT_CONSTEXPR auto code_point_length(const Char *begin) -> int
#define FMT_USE_LONG_DOUBLE
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
FMT_CONSTEXPR auto check_char_specs(const basic_format_specs< Char > &specs, ErrorHandler &&eh={}) -> bool
FMT_CONSTEXPR void check_string_type_spec(Char spec, ErrorHandler &&eh={})
typename std::remove_reference< T >::type remove_reference_t
typename detail::char_t_impl< S >::type char_t
#define FMT_END_DETAIL_NAMESPACE
#define FMT_MODULE_EXPORT_BEGIN
constexpr auto count() -> size_t
FMT_CONSTEXPR auto check_cstring_type_spec(Char spec, ErrorHandler &&eh={}) -> bool
FMT_CONSTEXPR void check_pointer_type_spec(Char spec, ErrorHandler &&eh)
#define FMT_BEGIN_NAMESPACE
#define FMT_BEGIN_DETAIL_NAMESPACE
constexpr auto const_check(T value) -> T
FMT_BEGIN_DETAIL_NAMESPACE auto get_container(std::back_insert_iterator< Container > it) -> Container &
#define FMT_BUFFER_CONTEXT(Char)
conditional_t< std::is_same< T, char >::value, appender, std::back_insert_iterator< buffer< T > > > buffer_appender
FMT_BEGIN_DETAIL_NAMESPACE void throw_format_error(const char *message)
#define FMT_ENABLE_IF(...)
#define FMT_CONSTEXPR_CHAR_TRAITS
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
#define FMT_MSC_WARNING(...)
typename type_identity< T >::type type_identity_t
FMT_BEGIN_DETAIL_NAMESPACE constexpr FMT_INLINE auto is_constant_evaluated() FMT_NOEXCEPT -> bool
typename std::conditional< B, T, F >::type conditional_t
typename std::remove_cv< remove_reference_t< T > >::type remove_cvref_t
#define FMT_END_NAMESPACE
#define FMT_MODULE_EXPORT_END
FMT_CONSTEXPR auto parse_float_type_spec(const basic_format_specs< Char > &specs, ErrorHandler &&eh={}) -> float_specs
constexpr auto compile_string_to_view(const Char(&s)[N]) -> basic_string_view< Char >
decltype(std::end(std::declval< T & >())) sentinel_t
FMT_INLINE void assume(bool condition)
constexpr auto num_bits() -> int
auto is_big_endian() -> bool
auto compute_width(basic_string_view< Char > s) -> size_t
constexpr auto num_bits< uint128_t >() -> int
auto base_iterator(std::back_insert_iterator< Container > &it, checked_ptr< typename Container::value_type >) -> std::back_insert_iterator< Container >
constexpr auto max_value() -> T
auto to_uintptr(const void *p) -> fallback_uintptr
decltype(std::begin(std::declval< T & >())) iterator_t
FMT_FUNC void print(std::FILE *f, string_view text)
auto bit_cast(const Source &source) -> Dest
constexpr auto to_pointer(OutputIt, size_t) -> T *
remove_reference_t< decltype(reserve(std::declval< OutputIt & >(), 0))> reserve_iterator
fallback_uintptr uintptr_t
auto write(OutputIt out, const std::tm &time, const std::locale &loc, char format, char modifier=0) -> OutputIt
auto reserve(std::back_insert_iterator< Container > it, size_t n) -> checked_ptr< typename Container::value_type >
FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T &value) -> OutputIt
constexpr auto num_bits< fallback_uintptr >() -> int
FMT_CONSTEXPR auto utf8_decode(const char *s, uint32_t *c, int *e) -> const char *
auto code_point_index(basic_string_view< Char > s, size_t n) -> size_t
auto get_data(std::basic_string< Char > &s) -> Char *
FMT_CONSTEXPR void for_each_codepoint(string_view s, F f)
constexpr auto num_bits< int128_t >() -> int
auto make_checked(T *p, size_t) -> T *
FMT_CONSTEXPR FMT_NOINLINE auto copy_str_noinline(InputIt begin, InputIt end, OutputIt out) -> OutputIt
FMT_API auto to_decimal(T x) FMT_NOEXCEPT -> decimal_fp< T >
static FMT_API constexpr const char left_padding_shifts[5]
static FMT_API constexpr const char hex_digits[]
static FMT_API constexpr const char digits[100][2]
static FMT_API constexpr const char signs[4]
static FMT_API constexpr const unsigned prefixes[4]
static FMT_API constexpr const char right_padding_shifts[5]
fallback_uintptr()=default
fallback_uintptr(const void *p)
typename float_info< T >::carrier_uint significand_type
significand_type significand
FMT_NORETURN FMT_API void on_error(const char *message)
join_view(It b, Sentinel e, basic_string_view< Char > s)
basic_string_view< Char > sep
FMT_CONSTEXPR write_int_data(int num_digits, unsigned prefix, const basic_format_specs< Char > &specs)
T uninitialized_copy(T... args)
T uninitialized_copy_n(T... args)