41 #include <system_error>
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
83 template <
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)
187 inline 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)
199 inline 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)
215 inline 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)
224 inline 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__)
241 # pragma managed(pop)
250 #if __cplusplus >= 202002L || \
251 (__cplusplus >= 201709L && FMT_GCC_VERSION >= 1002)
252 # define FMT_CONSTEXPR20 constexpr
254 # define FMT_CONSTEXPR20
260 template <
typename Dest,
typename Source>
262 static_assert(
sizeof(Dest) ==
sizeof(Source),
"size mismatch");
264 std::memcpy(&dest, &
source,
sizeof(dest));
271 char data[
sizeof(u)];
284 for (
size_t i = 0,
j =
sizeof(
void*) - 1; i <
j; ++i, --
j)
306 template <
typename T> constexpr
auto num_bits() ->
int {
307 return std::numeric_limits<T>::digits;
313 return static_cast<int>(
sizeof(
void*) *
314 std::numeric_limits<unsigned char>::digits);
319 #if FMT_HAS_BUILTIN(__builtin_assume)
320 __builtin_assume(condition);
325 template <
typename T>
330 template <
typename Char>
334 template <
typename Container>
339 #if defined(_SECURE_SCL) && _SECURE_SCL
341 template <
typename T>
using checked_ptr = stdext::checked_array_iterator<T*>;
342 template <
typename T>
auto make_checked(T* p,
size_t size) -> checked_ptr<T> {
347 template <
typename T>
inline auto make_checked(T* p,
size_t) ->
T* {
return p; }
357 reserve(std::back_insert_iterator<Container> it,
size_t n)
360 size_t size = c.size();
365 template <
typename T>
372 template <
typename Iterator>
373 constexpr
auto reserve(Iterator& it,
size_t) -> Iterator& {
377 template <
typename OutputIt>
381 template <
typename T,
typename OutputIt>
396 -> std::back_insert_iterator<Container> {
400 template <
typename Iterator>
407 template <
typename OutputIt,
typename Size,
typename T>
410 for (Size i = 0; i <
count; ++i) *out++ =
value;
413 template <
typename T,
typename Size>
416 return fill_n<T*, Size, T>(out,
count,
value);
428 template <
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;
483 template <
typename F>
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);
507 template <
typename Char>
514 size_t num_code_points = 0;
516 struct count_code_points {
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()));
550 template <
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;
567 template <
typename T>
569 sizeof(
T) <=
sizeof(
double)>;
571 #ifndef FMT_USE_FULL_CACHE_DRAGONBOX
572 # define FMT_USE_FULL_CACHE_DRAGONBOX 0
575 template <
typename T>
576 template <
typename U>
578 while (begin != end) {
580 try_reserve(size_ +
count);
581 auto free_cap = capacity_ - size_;
589 template <
typename T,
typename Enable =
void>
591 template <
typename T>
623 typename Allocator = std::allocator<T>>
634 if (data != store_) alloc_.deallocate(data, this->capacity());
646 this->set(store_, SIZE);
653 alloc_ = std::move(other.alloc_);
654 T*
data = other.data();
655 size_t size = other.size(), capacity = other.capacity();
656 if (data == other.store_) {
657 this->set(store_, capacity);
658 std::uninitialized_copy(other.store_, other.store_ + size,
661 this->set(data, capacity);
664 other.set(other.store_, 0);
701 void reserve(
size_t new_capacity) { this->try_reserve(new_capacity); }
704 using detail::buffer<T>::append;
705 template <
typename ContiguousRange>
707 append(range.data(), range.data() + range.size());
711 template <
typename T,
size_t SIZE,
typename Allocator>
714 if (size > 5000)
throw std::runtime_error(
"fuzz mode - won't grow that much");
716 const size_t max_size = std::allocator_traits<Allocator>::max_size(alloc_);
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();
725 std::allocator_traits<Allocator>::allocate(alloc_, new_capacity);
727 std::uninitialized_copy(old_data, old_data + this->
size(),
729 this->set(new_data, new_capacity);
733 if (old_data != store_) alloc_.deallocate(old_data, old_capacity);
738 template <
typename T,
size_t SIZE,
typename Allocator>
752 : std::runtime_error(message) {}
768 template <typename... Args, typename
S, typename Char =
char_t<S>>
776 "passing views as lvalues is disallowed");
782 namespace detail_exported {
783 #if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
784 template <
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),
794 template <
typename Char,
size_t N>
799 return {
s,
N - (std::char_traits<Char>::to_int_type(
s[
N - 1]) == 0 ? 1 : 0)};
801 template <
typename Char>
804 return {
s.
data(),
s.size()};
814 template <
typename T>
struct is_integral : std::is_integral<T> {};
818 template <
typename T>
843 template <
typename T>
848 template <
typename T>
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[][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[] = {0,
'-',
'+',
' '};
883 FMT_API static constexpr
const unsigned prefixes[4] = {0, 0, 0x1000000u |
'+',
885 FMT_API static constexpr
const char left_padding_shifts[] = {31, 31, 0, 1, 0};
886 FMT_API static constexpr
const char right_padding_shifts[] = {0, 31, 0, 1, 0};
904 if (
n < 100)
return count + 1;
905 if (
n < 1000)
return count + 2;
906 if (
n < 10000)
return count + 3;
920 #ifdef FMT_BUILTIN_CLZLL
924 constexpr uint16_t bsr2log10[] = {
925 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5,
926 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10,
927 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15,
928 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20};
929 auto t = bsr2log10[FMT_BUILTIN_CLZLL(
n | 1) ^ 63];
930 constexpr
const uint64_t zero_or_powers_of_10[] = {
932 10000000000000000000ULL};
933 return t - (
n < zero_or_powers_of_10[
t]);
940 template <
int BITS,
typename UInt>
942 #ifdef FMT_BUILTIN_CLZ
943 if (num_bits<UInt>() == 32)
944 return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(
n) | 1) ^ 31) / BITS + 1;
949 }
while ((
n >>= BITS) != 0);
960 #define FMT_INC(T) (((sizeof(#T) - 1ull) << 32) - T)
961 static constexpr uint64_t
table[] = {
979 #ifdef FMT_BUILTIN_CLZ
982 return static_cast<int>((
n + inc) >> 32);
1003 template <
typename Char>
1005 template <
typename Char>
1015 template <
typename Char>
1018 return Char(decimal_point_impl<char>(loc));
1021 return decimal_point_impl<wchar_t>(loc);
1025 template <
typename Char>
auto equal2(
const Char* lhs,
const char* rhs) ->
bool {
1026 return lhs[0] == rhs[0] && lhs[1] == rhs[1];
1028 inline auto equal2(
const char* lhs,
const char* rhs) ->
bool {
1029 return memcmp(lhs, rhs, 2) == 0;
1034 *dst++ =
static_cast<Char
>(*src++);
1035 *dst =
static_cast<Char
>(*src);
1047 template <
typename Char,
typename UInt>
1054 while (value >= 10) {
1055 *--out =
static_cast<Char
>(
'0' + value % 10);
1058 *--out =
static_cast<Char
>(
'0' +
value);
1061 while (value >= 100) {
1070 *--out =
static_cast<Char
>(
'0' +
value);
1078 template <
typename Char,
typename UInt,
typename Iterator,
1083 Char
buffer[digits10<UInt>() + 1];
1085 return {out, detail::copy_str_noinline<Char>(
buffer,
end, out)};
1088 template <
unsigned BASE_BITS,
typename Char,
typename UInt>
1090 bool upper =
false) -> Char* {
1095 unsigned digit = (value & ((1 << BASE_BITS) - 1));
1096 *--
buffer =
static_cast<Char
>(BASE_BITS < 4 ? static_cast<char>(
'0' + digit)
1098 }
while ((value >>= BASE_BITS) != 0);
1102 template <
unsigned BASE_BITS,
typename Char>
1104 bool =
false) -> Char* {
1105 auto char_digits = std::numeric_limits<unsigned char>::digits / 4;
1106 int start = (num_digits + char_digits - 1) / char_digits - 1;
1107 if (
int start_digits = num_digits % char_digits) {
1108 unsigned value =
n.value[start--];
1111 for (; start >= 0; --
start) {
1112 unsigned value =
n.value[
start];
1115 for (
int i = 0; i < char_digits; ++i) {
1116 unsigned digit = (value & ((1 << BASE_BITS) - 1));
1118 value >>= BASE_BITS;
1124 template <
unsigned BASE_BITS,
typename Char,
typename It,
typename UInt>
1132 char buffer[num_bits<UInt>() / BASE_BITS + 1];
1134 return detail::copy_str_noinline<Char>(
buffer, buffer + num_digits, out);
1145 auto size() const ->
size_t {
return buffer_.size() - 1; }
1146 auto c_str() const -> const
wchar_t* {
return &buffer_[0]; }
1147 auto str() const -> std::wstring {
return {&buffer_[0],
size()}; }
1150 namespace dragonbox {
1157 static const int significand_bits = 23;
1158 static const int exponent_bits = 8;
1159 static const int min_exponent = -126;
1160 static const int max_exponent = 127;
1161 static const int exponent_bias = -127;
1162 static const int decimal_digits = 9;
1163 static const int kappa = 1;
1164 static const int big_divisor = 100;
1165 static const int small_divisor = 10;
1166 static const int min_k = -31;
1167 static const int max_k = 46;
1168 static const int cache_bits = 64;
1169 static const int divisibility_check_by_5_threshold = 39;
1170 static const int case_fc_pm_half_lower_threshold = -1;
1171 static const int case_fc_pm_half_upper_threshold = 6;
1172 static const int case_fc_lower_threshold = -2;
1173 static const int case_fc_upper_threshold = 6;
1174 static const int case_shorter_interval_left_endpoint_lower_threshold = 2;
1175 static const int case_shorter_interval_left_endpoint_upper_threshold = 3;
1176 static const int shorter_interval_tie_lower_threshold = -35;
1177 static const int shorter_interval_tie_upper_threshold = -35;
1178 static const int max_trailing_zeros = 7;
1183 static const int significand_bits = 52;
1184 static const int exponent_bits = 11;
1185 static const int min_exponent = -1022;
1186 static const int max_exponent = 1023;
1187 static const int exponent_bias = -1023;
1188 static const int decimal_digits = 17;
1189 static const int kappa = 2;
1190 static const int big_divisor = 1000;
1191 static const int small_divisor = 100;
1192 static const int min_k = -292;
1193 static const int max_k = 326;
1194 static const int cache_bits = 128;
1195 static const int divisibility_check_by_5_threshold = 86;
1196 static const int case_fc_pm_half_lower_threshold = -2;
1197 static const int case_fc_pm_half_upper_threshold = 9;
1198 static const int case_fc_lower_threshold = -4;
1199 static const int case_fc_upper_threshold = 9;
1200 static const int case_shorter_interval_left_endpoint_lower_threshold = 2;
1201 static const int case_shorter_interval_left_endpoint_upper_threshold = 3;
1202 static const int shorter_interval_tie_lower_threshold = -77;
1203 static const int shorter_interval_tie_upper_threshold = -77;
1204 static const int max_trailing_zeros = 16;
1213 template <
typename T>
1217 template <
typename T>
1226 template <
typename Char,
typename It>
1230 *it++ =
static_cast<Char
>(
'-');
1233 *it++ =
static_cast<Char
>(
'+');
1237 if (
exp >= 1000) *it++ =
static_cast<Char
>(top[0]);
1238 *it++ =
static_cast<Char
>(top[1]);
1242 *it++ =
static_cast<Char
>(d[0]);
1243 *it++ =
static_cast<Char
>(d[1]);
1247 template <
typename T>
1252 template <
typename T>
1258 return static_cast<double>(
value);
1261 template <
typename OutputIt,
typename Char>
1264 auto fill_size =
fill.size();
1266 auto data =
fill.data();
1267 for (
size_t i = 0; i <
n; ++i)
1268 it = copy_str<Char>(data, data + fill_size, it);
1279 size_t size,
size_t width, F&&
f) -> OutputIt {
1282 size_t padding = spec_width >
width ? spec_width -
width : 0;
1285 size_t left_padding = padding >> shifts[specs.align];
1286 size_t right_padding = padding - left_padding;
1287 auto it =
reserve(out, size + padding * specs.fill.size());
1288 if (left_padding != 0) it =
fill(it, left_padding, specs.fill);
1290 if (right_padding != 0) it =
fill(it, right_padding, specs.fill);
1297 size_t size, F&&
f) -> OutputIt {
1298 return write_padded<align>(out, specs,
size,
size,
f);
1301 template <align::type align = align::left,
typename Char,
typename OutputIt>
1305 return write_padded<align>(
1306 out, specs,
bytes.size(), [
bytes](reserve_iterator<OutputIt> it) {
1307 const char* data =
bytes.data();
1308 return copy_str<Char>(
data, data +
bytes.size(), it);
1312 template <
typename Char,
typename OutputIt,
typename UIntPtr>
1317 auto write = [=](reserve_iterator<OutputIt> it) {
1318 *it++ =
static_cast<Char
>(
'0');
1319 *it++ =
static_cast<Char
>(
'x');
1320 return format_uint<4, Char>(it,
value, num_digits);
1322 return specs ? write_padded<align::right>(out, *specs,
size,
write)
1326 template <
typename Char,
typename OutputIt>
1330 return write_padded(out, specs, 1, [=](reserve_iterator<OutputIt> it) {
1335 template <
typename Char,
typename OutputIt>
1341 :
write(out, static_cast<
int>(value), specs, loc);
1352 : size((prefix >> 24) +
to_unsigned(num_digits)), padding(0) {
1359 }
else if (specs.
precision > num_digits) {
1370 template <
typename OutputIt,
typename Char,
typename W>
1374 W write_digits) -> OutputIt {
1379 for (
unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
1380 *it++ = static_cast<Char>(p & 0xff);
1385 return write_padded<align::right>(
1386 out, specs, data.size, [=](reserve_iterator<OutputIt> it) {
1387 for (
unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
1388 *it++ = static_cast<Char>(p & 0xff);
1390 return write_digits(it);
1394 template <
typename OutputIt,
typename UInt,
typename Char>
1399 const auto sep_size = 1;
1400 auto ts = thousands_sep<Char>(loc);
1401 if (!ts.thousands_sep)
return false;
1403 int size = num_digits,
n = num_digits;
1405 std::string::const_iterator group = groups.cbegin();
1406 while (group != groups.cend() && n > *group && *group > 0 &&
1407 *group != max_value<char>()) {
1412 if (group == groups.cend()) size += sep_size * ((n - 1) / groups.back());
1416 if (prefix != 0) ++
size;
1421 int digit_index = 0;
1422 group = groups.cbegin();
1423 auto p = buffer.data() + size - 1;
1424 for (
int i = num_digits - 1; i > 0; --i) {
1425 *p-- =
static_cast<Char
>(digits[i]);
1426 if (*group <= 0 || ++digit_index % *group != 0 ||
1427 *group == max_value<char>())
1429 if (group + 1 != groups.cend()) {
1437 *p-- =
static_cast<Char
>(*digits);
1438 if (prefix != 0) *p =
static_cast<Char
>(prefix);
1439 auto data = buffer.data();
1440 out = write_padded<align::right>(
1441 out, specs, usize, usize, [=](reserve_iterator<OutputIt> it) {
1442 return copy_str<Char>(
data, data +
size, it);
1448 prefix |= prefix != 0 ? value << 8 :
value;
1449 prefix += (1u + (value > 0xff ? 1 : 0)) << 24;
1457 template <
typename T>
1463 prefix = 0x01000000 |
'-';
1464 abs_value = 0 - abs_value;
1468 return {abs_value, prefix};
1471 template <
typename Char,
typename OutputIt,
typename T>
1476 auto abs_value =
arg.abs_value;
1477 auto prefix =
arg.prefix;
1478 auto utype =
static_cast<unsigned>(specs.
type);
1479 switch (specs.
type) {
1484 prefix, specs, loc)) {
1489 out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {
1490 return format_decimal<Char>(it, abs_value, num_digits).end;
1499 out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {
1500 return format_uint<4, Char>(it, abs_value, num_digits,
upper);
1506 int num_digits = count_digits<1>(abs_value);
1507 return write_int(out, num_digits, prefix, specs,
1508 [=](reserve_iterator<OutputIt> it) {
1509 return format_uint<1, Char>(it, abs_value, num_digits);
1513 int num_digits = count_digits<3>(abs_value);
1514 if (specs.
alt && specs.
precision <= num_digits && abs_value != 0) {
1519 return write_int(out, num_digits, prefix, specs,
1520 [=](reserve_iterator<OutputIt> it) {
1521 return format_uint<3, Char>(it, abs_value, num_digits);
1525 return write_char(out, static_cast<Char>(abs_value), specs);
1531 template <
typename Char,
typename OutputIt,
typename T,
1541 template <
typename Char,
typename OutputIt,
typename T,
1551 template <
typename Char,
typename OutputIt>
1554 auto data =
s.data();
1555 auto size =
s.size();
1561 [=](reserve_iterator<OutputIt> it) {
1562 return copy_str<Char>(
data, data +
size, it);
1565 template <
typename Char,
typename OutputIt>
1570 return write(out,
s, specs);
1572 template <
typename Char,
typename OutputIt>
1581 template <
typename Char,
typename OutputIt>
1585 isinf ? (fspecs.upper ?
"INF" :
"inf") : (fspecs.upper ?
"NAN" :
"nan");
1586 constexpr
size_t str_size = 3;
1587 auto sign = fspecs.sign;
1588 auto size = str_size + (
sign ? 1 : 0);
1590 const bool is_zero_fill =
1591 specs.
fill.size() == 1 && *specs.
fill.data() ==
static_cast<Char
>(
'0');
1592 if (is_zero_fill) specs.
fill[0] =
static_cast<Char
>(
' ');
1593 return write_padded(out, specs, size, [=](reserve_iterator<OutputIt> it) {
1595 return copy_str<Char>(str, str + str_size, it);
1607 return fp.significand_size;
1609 template <
typename T>
1614 template <
typename Char,
typename OutputIt>
1616 int& significand_size) -> OutputIt {
1617 return copy_str<Char>(significand, significand + significand_size, out);
1619 template <
typename Char,
typename OutputIt,
typename UInt>
1621 int significand_size) -> OutputIt {
1622 return format_decimal<Char>(out, significand, significand_size).end;
1625 template <
typename Char,
typename UInt,
1631 auto end =
format_decimal(out + 1, significand, significand_size).end;
1632 if (integral_size == 1) {
1635 std::uninitialized_copy_n(out + 1, integral_size,
1642 template <
typename OutputIt,
typename UInt,
typename Char,
1645 int significand_size,
int integral_size,
1648 Char
buffer[digits10<UInt>() + 2];
1651 return detail::copy_str_noinline<Char>(
buffer,
end, out);
1654 template <
typename OutputIt,
typename Char>
1656 int significand_size,
int integral_size,
1658 out = detail::copy_str_noinline<Char>(significand,
1659 significand + integral_size, out);
1662 return detail::copy_str_noinline<Char>(significand + integral_size,
1663 significand + significand_size, out);
1666 template <
typename OutputIt,
typename DecimalFP,
typename Char>
1670 auto significand = fp.significand;
1672 static const Char
zero =
static_cast<Char
>(
'0');
1673 auto sign = fspecs.sign;
1675 using iterator = reserve_iterator<OutputIt>;
1677 int output_exp = fp.exponent + significand_size - 1;
1678 auto use_exp_format = [=]() {
1683 const int exp_lower = -4, exp_upper = 16;
1684 return output_exp < exp_lower ||
1685 output_exp >= (fspecs.precision > 0 ? fspecs.precision : exp_upper);
1687 if (use_exp_format()) {
1689 if (fspecs.showpoint) {
1690 num_zeros = fspecs.precision - significand_size;
1691 if (num_zeros < 0) num_zeros = 0;
1693 }
else if (significand_size == 1) {
1696 auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp;
1698 if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3;
1701 char exp_char = fspecs.upper ?
'E' :
'e';
1702 auto write = [=](iterator it) {
1708 *it++ =
static_cast<Char
>(exp_char);
1709 return write_exponent<Char>(output_exp, it);
1711 return specs.
width > 0 ? write_padded<align::right>(out, specs,
size,
write)
1715 int exp = fp.exponent + significand_size;
1716 if (fp.exponent >= 0) {
1719 int num_zeros = fspecs.precision -
exp;
1721 if (num_zeros > 5000)
1722 throw std::runtime_error(
"fuzz mode - avoiding excessive cpu use");
1724 if (fspecs.showpoint) {
1726 if (num_zeros > 0) size +=
to_unsigned(num_zeros) + 1;
1728 return write_padded<align::right>(out, specs,
size, [&](iterator it) {
1730 it = write_significand<Char>(it, significand, significand_size);
1732 if (!fspecs.showpoint)
return it;
1736 }
else if (exp > 0) {
1738 int num_zeros = fspecs.showpoint ? fspecs.precision - significand_size : 0;
1739 size += 1 +
to_unsigned(num_zeros > 0 ? num_zeros : 0);
1740 return write_padded<align::right>(out, specs,
size, [&](iterator it) {
1748 int num_zeros = -
exp;
1749 if (significand_size == 0 && fspecs.precision >= 0 &&
1750 fspecs.precision < num_zeros) {
1751 num_zeros = fspecs.precision;
1753 bool pointy = num_zeros != 0 || significand_size != 0 || fspecs.showpoint;
1754 size += 1 + (pointy ? 1 : 0) +
to_unsigned(num_zeros);
1755 return write_padded<align::right>(out, specs,
size, [&](iterator it) {
1758 if (!pointy)
return it;
1761 return write_significand<Char>(it, significand, significand_size);
1765 template <
typename Char,
typename OutputIt,
typename T,
1772 if (std::signbit(value)) {
1779 if (!std::isfinite(value))
1794 return write_bytes<align::right>(out, {buffer.data(), buffer.size()},
1799 if (precision == max_value<int>())
1809 fspecs.
locale ? decimal_point<Char>(loc) : static_cast<Char>(
'.');
1810 auto fp =
big_decimal_fp{buffer.data(),
static_cast<int>(buffer.size()), exp};
1811 return write_float(out, fp, specs, fspecs, point);
1814 template <
typename Char,
typename OutputIt,
typename T,
1816 auto write(OutputIt out, T value) -> OutputIt {
1824 auto sign_bit = bits & (
uint(1) << (num_bits<uint>() - 1));
1825 if (sign_bit != 0) {
1831 uint mask = exponent_mask<floaty>();
1832 if ((bits & mask) ==
mask)
1836 return write_float(out, dec, specs, fspecs, static_cast<Char>(
'.'));
1839 template <
typename Char,
typename OutputIt,
typename T,
1842 inline auto write(OutputIt out, T value) -> OutputIt {
1846 template <
typename Char,
typename OutputIt>
1853 template <
typename Char,
typename OutputIt>
1856 auto it =
reserve(out, value.size());
1857 it = copy_str_noinline<Char>(value.begin(), value.end(), it);
1861 template <
typename Char,
typename OutputIt,
typename T,
1863 constexpr
auto write(OutputIt out,
const T& value) -> OutputIt {
1867 template <
typename Char,
typename OutputIt,
typename T,
1875 if (negative) abs_value = ~abs_value + 1;
1877 auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits);
1879 if (
auto ptr = to_pointer<Char>(it, size)) {
1880 if (negative) *
ptr++ =
static_cast<Char
>(
'-');
1881 format_decimal<Char>(
ptr, abs_value, num_digits);
1884 if (negative) *it++ =
static_cast<Char
>(
'-');
1885 it = format_decimal<Char>(it, abs_value, num_digits).end;
1891 typename Char,
typename OutputIt,
typename T,
1902 template <
typename Char,
typename OutputIt,
typename T,
1907 return specs.
type && specs.
type !=
's'
1908 ?
write(out, value ? 1 : 0, specs, {})
1909 :
write_bytes(out, value ?
"true" :
"false", specs);
1912 template <
typename Char,
typename OutputIt>
1919 template <
typename Char,
typename OutputIt>
1931 template <
typename Char,
typename OutputIt,
typename T,
1933 auto write(OutputIt out,
const T* value,
1937 return write_ptr<Char>(out,
to_uintptr(value), &specs);
1940 template <
typename Char,
typename OutputIt,
typename T>
1942 typename std::enable_if<
1947 using formatter_type =
1949 typename context_type::template formatter_type<T>,
1951 context_type ctx(out, {}, {});
1952 return formatter_type().format(value, ctx);
1966 return write<Char>(out,
value);
1971 h.format(parse_ctx, format_ctx);
1972 return format_ctx.out();
1984 template <
typename T>
2001 h.format(parse_ctx, ctx);
2006 template <
typename T>
2018 if (
is_negative(value)) handler_.on_error(
"negative width");
2019 return static_cast<unsigned long long>(
value);
2024 handler_.on_error(
"width is not integer");
2038 if (
is_negative(value)) handler_.on_error(
"negative precision");
2039 return static_cast<unsigned long long>(
value);
2044 handler_.on_error(
"precision is not integer");
2052 template <
template <
typename>
class Handler,
typename FormatArg,
2056 if (value >
to_unsigned(max_value<int>())) eh.on_error(
"number is too big");
2057 return static_cast<int>(
value);
2060 template <
typename Context,
typename ID>
2062 typename Context::format_arg {
2063 auto arg = ctx.arg(
id);
2064 if (!
arg) ctx.on_error(
"argument not found");
2082 parse_context_.check_arg_id(arg_id);
2087 parse_context_.check_arg_id(arg_id);
2095 :
specs_setter<Char>(specs), parse_context_(parse_ctx), context_(ctx) {}
2098 this->specs_.width = get_dynamic_spec<width_checker>(
2099 get_arg(arg_id), context_.error_handler());
2103 this->specs_.precision = get_dynamic_spec<precision_checker>(
2104 get_arg(arg_id), context_.error_handler());
2110 template <
template <
typename>
class Handler,
typename Context>
2118 value = detail::get_dynamic_spec<Handler>(ctx.arg(ref.
val.
index),
2119 ctx.error_handler());
2122 value = detail::get_dynamic_spec<Handler>(ctx.arg(ref.
val.
name),
2123 ctx.error_handler());
2128 #define FMT_STRING_IMPL(s, base, explicit) \
2132 struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base { \
2133 using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
2134 FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit \
2135 operator fmt::basic_string_view<char_type>() const { \
2136 return fmt::detail_exported::compile_string_to_view<char_type>(s); \
2139 return FMT_COMPILE_STRING(); \
2152 #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::compile_string, )
2154 #if FMT_USE_USER_DEFINED_LITERALS
2155 template <
typename Char>
struct udl_formatter {
2158 template <
typename... T>
2160 return vformat(str, fmt::make_args_checked<T...>(str,
args...));
2164 # if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
2165 template <
typename T,
typename Char,
size_t N,
2166 fmt::detail_exported::fixed_string<Char, N> Str>
2167 struct statically_named_arg :
view {
2168 static constexpr
auto name = Str.data;
2171 statically_named_arg(
const T&
v) : value(v) {}
2174 template <
typename T,
typename Char,
size_t N,
2175 fmt::detail_exported::fixed_string<Char, N> Str>
2176 struct is_named_arg<statically_named_arg<T, Char, N, Str>> : std::true_type {};
2178 template <
typename T,
typename Char,
size_t N,
2179 fmt::detail_exported::fixed_string<Char, N> Str>
2181 : std::true_type {};
2183 template <
typename Char,
size_t N,
2184 fmt::detail_exported::fixed_string<Char, N> Str>
2186 template <
typename T>
auto operator=(T&& value)
const {
2187 return statically_named_arg<T, Char, N, Str>(std::forward<T>(
value));
2191 template <
typename Char>
struct udl_arg {
2195 return {str, std::forward<T>(
value)};
2199 #endif // FMT_USE_USER_DEFINED_LITERALS
2201 template <
typename Locale,
typename Char>
2207 return {buffer.data(), buffer.size()};
2239 template <
typename... T>
2275 mutable char buffer_[buffer_size];
2278 template <
typename UInt>
auto format_unsigned(UInt value) ->
char* {
2279 auto n =
static_cast<detail::uint32_or_64_or_128_t<UInt>
>(
value);
2283 template <
typename Int>
auto format_signed(
Int value) ->
char* {
2284 auto abs_value =
static_cast<detail::uint32_or_64_or_128_t<Int>
>(
value);
2286 if (negative) abs_value = 0 - abs_value;
2287 auto begin = format_unsigned(abs_value);
2288 if (negative) *--
begin =
'-';
2295 explicit format_int(
long long value) : str_(format_signed(value)) {}
2296 explicit format_int(
unsigned value) : str_(format_unsigned(value)) {}
2297 explicit format_int(
unsigned long value) : str_(format_unsigned(value)) {}
2299 : str_(format_unsigned(value)) {}
2310 auto data() const -> const
char* {
return str_; }
2317 buffer_[buffer_size - 1] =
'\0';
2329 template <
typename T,
typename Char>
2330 template <
typename FormatContext>
2336 const -> decltype(ctx.out()) {
2337 if (specs_.width_ref.kind != detail::arg_id_kind::none ||
2338 specs_.precision_ref.kind != detail::arg_id_kind::none) {
2339 auto specs = specs_;
2340 detail::handle_dynamic_spec<detail::width_checker>(specs.
width,
2341 specs.width_ref, ctx);
2342 detail::handle_dynamic_spec<detail::precision_checker>(
2343 specs.
precision, specs.precision_ref, ctx);
2344 return detail::write<Char>(ctx.out(),
val, specs, ctx.locale());
2346 return detail::write<Char>(ctx.out(),
val, specs_, ctx.locale());
2349 #define FMT_FORMAT_AS(Type, Base) \
2350 template <typename Char> \
2351 struct formatter<Type, Char> : formatter<Base, Char> { \
2352 template <typename FormatContext> \
2353 auto format(Type const& val, FormatContext& ctx) const \
2354 -> decltype(ctx.out()) { \
2355 return formatter<Base, Char>::format(static_cast<Base>(val), ctx); \
2370 template <
typename Char>
2372 template <
typename FormatContext>
2373 auto format(
void*
val, FormatContext& ctx)
const -> decltype(ctx.out()) {
2378 template <
typename Char,
size_t N>
2380 template <
typename FormatContext>
2382 -> decltype(ctx.out()) {
2401 detail::dynamic_format_specs<Char> specs_;
2402 const Char* format_str_;
2404 struct null_handler : detail::error_handler {
2410 template <
typename Context>
void handle_specs(
Context& ctx) {
2411 detail::handle_dynamic_spec<detail::width_checker>(specs_.width,
2412 specs_.width_ref, ctx);
2413 detail::handle_dynamic_spec<detail::precision_checker>(
2414 specs_.precision, specs_.precision_ref, ctx);
2418 template <
typename ParseContext>
2420 format_str_ = ctx.begin();
2422 detail::dynamic_specs_handler<ParseContext> handler(specs_, ctx);
2426 template <
typename T,
typename FormatContext>
2427 auto format(
const T&
val, FormatContext& ctx) -> decltype(ctx.out()) {
2429 detail::specs_checker<null_handler>
checker(
2431 checker.on_align(specs_.align);
2432 if (specs_.sign !=
sign::none) checker.on_sign(specs_.sign);
2433 if (specs_.alt) checker.on_hash();
2434 if (specs_.precision >= 0) checker.end_precision();
2435 return detail::write<Char>(ctx.out(),
val, specs_, ctx.locale());
2448 template <
typename T>
auto ptr(T p) ->
const void* {
2452 template <
typename T>
auto ptr(
const std::unique_ptr<T>& p) ->
const void* {
2455 template <
typename T>
auto ptr(
const std::shared_ptr<T>& p) ->
const void* {
2470 detail::dynamic_format_specs<char> specs_;
2473 template <
typename ParseContext>
2475 using handler_type = detail::dynamic_specs_handler<ParseContext>;
2476 detail::specs_checker<handler_type> handler(handler_type(specs_, ctx),
2477 detail::type::string_type);
2483 template <
typename FormatContext>
2485 detail::handle_dynamic_spec<detail::width_checker>(specs_.width,
2486 specs_.width_ref, ctx);
2487 detail::handle_dynamic_spec<detail::precision_checker>(
2488 specs_.precision, specs_.precision_ref, ctx);
2493 template <
typename It,
typename Sentinel,
typename Char =
char>
2500 :
begin(b), end(e), sep(s) {}
2503 template <
typename It,
typename Sentinel,
typename Char>
2506 template <
typename It,
typename Sentinel,
typename Char>
2511 using mapper = detail::arg_mapper<context>;
2514 static auto map(
const T& value) ->
const T& {
2518 static auto map(
const T& value) -> decltype(mapper().map(value)) {
2519 return mapper().map(value);
2522 using formatter_type =
2525 std::declval<const value_type&>()))>,
2527 detail::fallback_formatter<value_type, Char>>;
2529 formatter_type value_formatter_;
2532 template <
typename ParseContext>
2534 return value_formatter_.parse(ctx);
2537 template <
typename FormatContext>
2539 -> decltype(ctx.out()) {
2540 auto it = value.begin;
2541 auto out = ctx.out();
2542 if (it != value.end) {
2543 out = value_formatter_.format(map(*it++), ctx);
2544 while (it != value.end) {
2545 out = detail::copy_str<Char>(value.sep.begin(), value.sep.end(), out);
2546 ctx.advance_to(out);
2547 out = value_formatter_.format(map(*it++), ctx);
2558 template <
typename It,
typename Sentinel>
2579 template <
typename Range>
2599 detail::write<char>(std::back_inserter(
result),
value);
2607 constexpr
int max_size = detail::digits10<T>() + 2;
2608 char buffer[max_size > 5 ?
static_cast<unsigned>(max_size) : 5];
2610 return std::string(begin, detail::write<char>(begin, value));
2613 template <
typename Char,
size_t SIZE>
2616 auto size =
buf.size();
2623 template <
typename Char>
2629 using detail::arg_formatter;
2631 using detail::custom_formatter;
2632 using detail::default_arg_formatter;
2634 using detail::locale_ref;
2636 using detail::specs_checker;
2637 using detail::specs_handler;
2655 : parse_context(str), context(out,
args, loc) {}
2657 void on_text(
const Char*
begin,
const Char* end) {
2659 context.advance_to(write<Char>(context.out(), text));
2663 return parse_context.next_arg_id();
2666 return parse_context.check_arg_id(
id),
id;
2669 int arg_id = context.arg_id(
id);
2670 if (arg_id < 0) on_error(
"argument not found");
2674 FMT_INLINE void on_replacement_field(
int id,
const Char*) {
2682 auto on_format_specs(
int id,
const Char* begin,
const Char* end)
2686 parse_context.advance_to(parse_context.begin() +
2687 (begin - &*parse_context.begin()));
2689 return parse_context.begin();
2695 if (begin == end || *begin !=
'}')
2696 on_error(
"missing '}' in format string");
2702 detail::parse_format_string<false>(fmt, format_handler(out, fmt,
args, loc));
2705 #ifndef FMT_HEADER_ONLY
2708 detail::locale_ref);
2730 #endif // FMT_HEADER_ONLY
2733 inline namespace literals {
2744 #if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
2745 template <detail_exported::fixed_
string Str>
2746 constexpr
auto operator""_a()
2748 sizeof(Str.data) /
sizeof(decltype(Str.data[0])), Str> {
2752 constexpr
auto operator"" _a(
const char*
s,
size_t) -> detail::udl_arg<char> {
2767 constexpr
auto operator"" _format(
const char*
s,
size_t n)
2768 -> detail::udl_formatter<char> {
2779 template <
typename Locale,
typename...
T,
2786 template <
typename...
T,
size_t SIZE,
typename Allocator>
2794 template <
typename OutputIt,
typename Locale,
2800 auto&&
buf = get_buffer<char>(out);
2805 template <
typename OutputIt,
typename Locale,
typename...
T,
2816 #ifdef FMT_DEPRECATED_INCLUDE_XCHAR
2820 #ifdef FMT_HEADER_ONLY
2821 # define FMT_FUNC inline
2827 #endif // FMT_FORMAT_H_
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
constexpr auto num_bits< int128_t >() -> int
#define FMT_MODULE_EXPORT_END
constexpr auto max_value() -> T
basic_string_view< Char > name
auto data() FMT_NOEXCEPT-> T *
#define FMT_ENABLE_IF(...)
GLuint GLsizei const GLchar * message
auto make_checked(T *p, size_t) -> T *
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
FMT_CONSTEXPR precision_checker(ErrorHandler &eh)
FMT_INLINE void check_format_string(const S &)
typename std::enable_if< B, T >::type enable_if_t
Define Imath::enable_if_t to be std for C++14, equivalent for C++11.
GLenum GLuint GLenum GLsizei const GLchar * buf
static FMT_API constexpr const char hex_digits[]
static FMT_API constexpr const unsigned prefixes[4]
std::string upper(string_view a)
Return an all-upper case version of a (locale-independent).
bool_constant< std::numeric_limits< T >::is_iec559 &&sizeof(T)<=sizeof(double)> is_fast_float
typename float_info< T >::carrier_uint significand_type
FMT_BEGIN_DETAIL_NAMESPACE constexpr FMT_INLINE auto is_constant_evaluated() FMT_NOEXCEPT-> bool
FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(const Char *begin, const Char *end, SpecHandler &&handler) -> const Char *
#define FMT_BEGIN_DETAIL_NAMESPACE
static FMT_API constexpr const char signs[]
void reserve(size_t new_capacity)
#define FMT_END_DETAIL_NAMESPACE
T negative(const T &val)
Return the unary negation of the given value.
void swap(UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &a, UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &b)
FMT_CONSTEXPR void check_pointer_type_spec(Char spec, ErrorHandler &&eh)
typename std::conditional< B, T, F >::type conditional_t
static FMT_API constexpr const char digits[][2]
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
constexpr auto num_bits() -> int
decltype(std::begin(std::declval< T & >())) iterator_t
#define FMT_CONSTEXPR_CHAR_TRAITS
constexpr auto const_check(T value) -> T
void on_error(const char *message)
conditional_t< std::is_same< T, char >::value, appender, std::back_insert_iterator< buffer< T >>> buffer_appender
GLuint GLsizei GLsizei * length
fallback_uintptr uintptr_t
auto c_str() const -> const wchar_t *
void append(const ContiguousRange &range)
decltype(std::end(std::declval< T & >())) sentinel_t
ImageBuf OIIO_API checker(int width, int height, int depth, cspan< float > color1, cspan< float > color2, int xoffset, int yoffset, int zoffset, ROI roi, int nthreads=0)
**But if you need a result
typename std::remove_cv< remove_reference_t< T >>::type remove_cvref_t
FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T &value) -> OutputIt
remove_reference_t< decltype(reserve(std::declval< OutputIt & >(), 0))> reserve_iterator
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
constexpr auto size() const -> size_t
auto code_point_index(basic_string_view< Char > s, size_t n) -> size_t
FMT_API auto to_decimal(T x) FMT_NOEXCEPT-> decimal_fp< T >
fallback_uintptr(const void *p)
constexpr const_pointer data() const noexcept
#define FMT_END_NAMESPACE
significand_type significand
basic_string_view< char > string_view
constexpr size_type size() const noexcept
__attribute__((visibility("default")))
auto get_data(std::basic_string< Char > &s) -> Char *
void try_reserve(size_t new_capacity)
auto get_iterator(Buffer &buf) -> decltype(buf.out())
auto base_iterator(std::back_insert_iterator< Container > &it, checked_ptr< typename Container::value_type >) -> std::back_insert_iterator< Container >
auto str() const -> std::wstring
constexpr auto data() const -> const Char *
const wchar_t & const_reference
auto get_allocator() const -> Allocator
IMATH_NAMESPACE::V2f float
FMT_INLINE auto to_string_view(const Char *s) -> basic_string_view< Char >
OIIO_FORCEINLINE OIIO_HOSTDEVICE OUT_TYPE bit_cast(const IN_TYPE &in)
auto size() const -> size_t
FMT_FUNC void print(std::FILE *f, string_view text)
join_view(It b, Sentinel e, basic_string_view< Char > s)
GLsizei GLsizei GLchar * source
typename std::remove_reference< T >::type remove_reference_t
static FMT_API constexpr const char left_padding_shifts[]
constexpr auto base_iterator(Iterator, Iterator it) -> Iterator
FMT_MSC_WARNING(suppress:4566) const expr unsigned char micro[]
auto capacity() const FMT_NOEXCEPT-> size_t
FMT_BEGIN_DETAIL_NAMESPACE auto get_container(std::back_insert_iterator< Container > it) -> Container &
void try_resize(size_t count)
#define FMT_USE_LONG_DOUBLE
auto compute_width(basic_string_view< char8_type > s) -> size_t
GLuint const GLchar * name
FMT_CONSTEXPR auto utf8_decode(const char *s, uint32_t *c, int *e) -> const char *
IMATH_HOSTDEVICE constexpr int sign(T a) IMATH_NOEXCEPT
std::wstring OIIO_UTIL_API utf8_to_utf16(string_view utf8str) noexcept
auto to_uintptr(const void *p) -> fallback_uintptr
FMT_CONSTEXPR void on_dynamic_width(Id arg_id)
GLboolean GLboolean GLboolean b
constexpr auto make_format_args(const Args &...args) -> format_arg_store< Context, Args...>
FMT_CONSTEXPR FMT_NOINLINE auto copy_str_noinline(InputIt begin, InputIt end, OutputIt out) -> OutputIt
GLenum GLenum GLsizei void * table
FMT_NORETURN FMT_API void on_error(const char *message)
auto get_buffer(OutputIt out) -> iterator_buffer< OutputIt, T >
FMT_CONSTEXPR write_int_data(int num_digits, unsigned prefix, const basic_format_specs< Char > &specs)
FMT_CONSTEXPR specs_handler(basic_format_specs< Char > &specs, basic_format_parse_context< Char > &parse_ctx, buffer_context< Char > &ctx)
GLenum GLint GLint * precision
auto reserve(std::back_insert_iterator< Container > it, size_t n) -> checked_ptr< typename Container::value_type >
constexpr auto num_bits< fallback_uintptr >() -> int
FMT_INLINE void assume(bool condition)
GLfloat GLfloat GLfloat GLfloat h
basic_string_view< Char > sep
auto bit_cast(const Source &source) -> Dest
FMT_CONSTEXPR width_checker(ErrorHandler &eh)
typename type_identity< T >::type type_identity_t
constexpr auto num_bits< uint128_t >() -> int
LeafData & operator=(const LeafData &)=delete
auto code_point_index(basic_string_view< char8_type > s, size_t n) -> size_t
static FMT_API constexpr const char right_padding_shifts[]
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
constexpr auto to_pointer(OutputIt, size_t) -> T *
GA_API const UT_StringHolder N
FMT_CONSTEXPR auto code_point_length(const Char *begin) -> int
basic_memory_buffer(basic_memory_buffer &&other) FMT_NOEXCEPT
FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg) -> decltype(vis(0))
**If you just want to fire and args
GLdouble GLdouble GLdouble top
FMT_CONSTEXPR void on_dynamic_precision(Id arg_id)
void resize(size_t count)
#define FMT_CLANG_VERSION
basic_memory_buffer(const Allocator &alloc=Allocator())
FMT_CONSTEXPR auto check_cstring_type_spec(Char spec, ErrorHandler &&eh={}) -> bool
#define FMT_ASSERT(condition, message)
#define FMT_BEGIN_NAMESPACE
auto compute_width(basic_string_view< Char > s) -> size_t
void append(const U *begin, const U *end)
constexpr auto compile_string_to_view(detail::std_string_view< Char > s) -> basic_string_view< Char >
auto size() const FMT_NOEXCEPT-> size_t
FMT_CONSTEXPR void for_each_codepoint(string_view s, F f)
constexpr auto reserve(Iterator &it, size_t) -> Iterator &
ImageBuf OIIO_API zero(ROI roi, int nthreads=0)
#define FMT_MODULE_EXPORT_BEGIN
void grow(size_t size) final FMT_OVERRIDE
auto is_big_endian() -> bool
std::integral_constant< bool, B > bool_constant
PXR_NAMESPACE_OPEN_SCOPE typedef unsigned char uchar
FMT_CONSTEXPR auto parse_float_type_spec(const basic_format_specs< Char > &specs, ErrorHandler &&eh={}) -> float_specs
fallback_uintptr()=default
FMT_CONSTEXPR void check_string_type_spec(Char spec, ErrorHandler &&eh)
FMT_CONSTEXPR auto check_char_specs(const basic_format_specs< Char > &specs, ErrorHandler &&eh={}) -> bool
auto operator=(basic_memory_buffer &&other) FMT_NOEXCEPT-> basic_memory_buffer &
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.