11#if defined(FMT_IMPORT_STD) && !defined(FMT_MODULE)
20# include <type_traits>
24#define FMT_VERSION 110100
27#if defined(__clang__) && !defined(__ibmxl__)
28# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__)
30# define FMT_CLANG_VERSION 0
32#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
33# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
35# define FMT_GCC_VERSION 0
38# define FMT_ICC_VERSION __ICL
39#elif defined(__INTEL_COMPILER)
40# define FMT_ICC_VERSION __INTEL_COMPILER
42# define FMT_ICC_VERSION 0
45# define FMT_MSC_VERSION _MSC_VER
47# define FMT_MSC_VERSION 0
51#ifdef _GLIBCXX_RELEASE
52# define FMT_GLIBCXX_RELEASE _GLIBCXX_RELEASE
54# define FMT_GLIBCXX_RELEASE 0
57# define FMT_LIBCPP_VERSION _LIBCPP_VERSION
59# define FMT_LIBCPP_VERSION 0
63# define FMT_CPLUSPLUS _MSVC_LANG
65# define FMT_CPLUSPLUS __cplusplus
70# define FMT_HAS_FEATURE(x) __has_feature(x)
72# define FMT_HAS_FEATURE(x) 0
75# define FMT_HAS_INCLUDE(x) __has_include(x)
77# define FMT_HAS_INCLUDE(x) 0
80# define FMT_HAS_BUILTIN(x) __has_builtin(x)
82# define FMT_HAS_BUILTIN(x) 0
84#ifdef __has_cpp_attribute
85# define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
87# define FMT_HAS_CPP_ATTRIBUTE(x) 0
90#define FMT_HAS_CPP14_ATTRIBUTE(attribute) \
91 (FMT_CPLUSPLUS >= 201402L && FMT_HAS_CPP_ATTRIBUTE(attribute))
93#define FMT_HAS_CPP17_ATTRIBUTE(attribute) \
94 (FMT_CPLUSPLUS >= 201703L && FMT_HAS_CPP_ATTRIBUTE(attribute))
97#ifdef FMT_USE_CONSTEXPR
99#elif FMT_GCC_VERSION >= 600 && FMT_CPLUSPLUS >= 201402L
102# define FMT_USE_CONSTEXPR 1
104# define FMT_USE_CONSTEXPR 0
105#elif FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VERSION >= 1912
106# define FMT_USE_CONSTEXPR 1
108# define FMT_USE_CONSTEXPR 0
111# define FMT_CONSTEXPR constexpr
113# define FMT_CONSTEXPR
117#if !defined(__cpp_lib_is_constant_evaluated)
118# define FMT_USE_CONSTEVAL 0
119#elif FMT_CPLUSPLUS < 201709L
120# define FMT_USE_CONSTEVAL 0
121#elif FMT_GLIBCXX_RELEASE && FMT_GLIBCXX_RELEASE < 10
122# define FMT_USE_CONSTEVAL 0
123#elif FMT_LIBCPP_VERSION && FMT_LIBCPP_VERSION < 10000
124# define FMT_USE_CONSTEVAL 0
125#elif defined(__apple_build_version__) && __apple_build_version__ < 14000029L
126# define FMT_USE_CONSTEVAL 0
127#elif FMT_MSC_VERSION && FMT_MSC_VERSION < 1929
128# define FMT_USE_CONSTEVAL 0
129#elif defined(__cpp_consteval)
130# define FMT_USE_CONSTEVAL 1
131#elif FMT_GCC_VERSION >= 1002 || FMT_CLANG_VERSION >= 1101
132# define FMT_USE_CONSTEVAL 1
134# define FMT_USE_CONSTEVAL 0
137# define FMT_CONSTEVAL consteval
138# define FMT_CONSTEXPR20 constexpr
140# define FMT_CONSTEVAL
141# define FMT_CONSTEXPR20
145#ifdef FMT_USE_EXCEPTIONS
147#elif defined(__GNUC__) && !defined(__EXCEPTIONS)
148# define FMT_USE_EXCEPTIONS 0
149#elif defined(__clang__) && !defined(__cpp_exceptions)
150# define FMT_USE_EXCEPTIONS 0
151#elif FMT_MSC_VERSION && !_HAS_EXCEPTIONS
152# define FMT_USE_EXCEPTIONS 0
154# define FMT_USE_EXCEPTIONS 1
156#if FMT_USE_EXCEPTIONS
158# define FMT_CATCH(x) catch (x)
160# define FMT_TRY if (true)
161# define FMT_CATCH(x) if (false)
164#if FMT_HAS_CPP17_ATTRIBUTE(fallthrough)
165# define FMT_FALLTHROUGH [[fallthrough]]
166#elif defined(__clang__)
167# define FMT_FALLTHROUGH [[clang::fallthrough]]
168#elif FMT_GCC_VERSION >= 700 && \
169 (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 520)
170# define FMT_FALLTHROUGH [[gnu::fallthrough]]
172# define FMT_FALLTHROUGH
176#if FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && !defined(__NVCC__)
177# define FMT_NORETURN [[noreturn]]
184#elif FMT_HAS_CPP17_ATTRIBUTE(nodiscard)
185# define FMT_NODISCARD [[nodiscard]]
187# define FMT_NODISCARD
192#elif FMT_HAS_CPP14_ATTRIBUTE(deprecated)
193# define FMT_DEPRECATED [[deprecated]]
195# define FMT_DEPRECATED
198#ifdef FMT_ALWAYS_INLINE
200#elif FMT_GCC_VERSION || FMT_CLANG_VERSION
201# define FMT_ALWAYS_INLINE inline __attribute__((always_inline))
203# define FMT_ALWAYS_INLINE inline
207# define FMT_INLINE FMT_ALWAYS_INLINE
209# define FMT_INLINE inline
212#if FMT_GCC_VERSION || FMT_CLANG_VERSION
213# define FMT_VISIBILITY(value) __attribute__((visibility(value)))
215# define FMT_VISIBILITY(value)
219#define FMT_PRAGMA_IMPL(x) _Pragma(#x)
220#if FMT_GCC_VERSION >= 504 && !defined(__NVCOMPILER)
223# define FMT_PRAGMA_GCC(x) FMT_PRAGMA_IMPL(GCC x)
225# define FMT_PRAGMA_GCC(x)
228# define FMT_PRAGMA_CLANG(x) FMT_PRAGMA_IMPL(clang x)
230# define FMT_PRAGMA_CLANG(x)
233# define FMT_MSC_WARNING(...) __pragma(warning(__VA_ARGS__))
235# define FMT_MSC_WARNING(...)
238#ifndef FMT_BEGIN_NAMESPACE
239# define FMT_BEGIN_NAMESPACE \
241 inline namespace v11 {
242# define FMT_END_NAMESPACE \
249# define FMT_BEGIN_EXPORT
250# define FMT_END_EXPORT
259#if !defined(FMT_HEADER_ONLY) && FMT_WIN32
260# if defined(FMT_LIB_EXPORT)
261# define FMT_API __declspec(dllexport)
262# elif defined(FMT_SHARED)
263# define FMT_API __declspec(dllimport)
265#elif defined(FMT_LIB_EXPORT) || defined(FMT_SHARED)
266# define FMT_API FMT_VISIBILITY("default")
272#ifndef FMT_OPTIMIZE_SIZE
273# define FMT_OPTIMIZE_SIZE 0
278#ifndef FMT_BUILTIN_TYPES
279# define FMT_BUILTIN_TYPES 1
282#define FMT_APPLY_VARIADIC(expr) \
283 using ignore = int[]; \
284 (void)ignore { 0, (expr, 0)... }
288#if !defined(__OPTIMIZE__) && !defined(__CUDACC__)
296template <
bool B,
typename T =
void>
298template <
bool B,
typename T,
typename F>
311template <
typename T>
using decay_t =
typename std::decay<T>::type;
314#if FMT_GCC_VERSION && FMT_GCC_VERSION < 500
316template <
typename...>
struct void_t_impl {
319template <
typename... T>
using void_t =
typename void_t_impl<T...>::type;
321template <
typename...>
using void_t = void;
332# define FMT_ENABLE_IF(...)
334# define FMT_ENABLE_IF(...) fmt::enable_if_t<(__VA_ARGS__), int> = 0
337template <
typename T>
constexpr auto min_of(T a, T b) -> T {
338 return a < b ? a : b;
340template <
typename T>
constexpr auto max_of(T a, T b) -> T {
341 return a > b ? a : b;
354#if FMT_CPLUSPLUS >= 202002L && FMT_GLIBCXX_RELEASE >= 12 && \
355 (FMT_CLANG_VERSION >= 1400 && FMT_CLANG_VERSION < 1500)
357 return __builtin_is_constant_evaluated();
358#elif defined(__cpp_lib_is_constant_evaluated)
360 return std::is_constant_evaluated();
362 return default_value;
372 const char* message);
374#if defined(FMT_ASSERT)
378# define FMT_ASSERT(condition, message) \
379 fmt::detail::ignore_unused((condition), (message))
381# define FMT_ASSERT(condition, message) \
384 : fmt::detail::assert_fail(__FILE__, __LINE__, (message)))
389#elif defined(__SIZEOF_INT128__) && !defined(__NVCC__) && \
390 !(FMT_CLANG_VERSION && FMT_MSC_VERSION)
391# define FMT_USE_INT128 1
397# define FMT_USE_INT128 0
407#ifndef FMT_USE_BITINT
408# define FMT_USE_BITINT (FMT_CLANG_VERSION >= 1500)
413template <
int N>
using bitint = _BitInt(N);
414template <
int N>
using ubitint =
unsigned _BitInt(N);
421template <
typename Int>
423 FMT_ASSERT(std::is_unsigned<Int>::value ||
value >= 0,
"negative value");
427template <
typename Char>
432template <
typename T,
typename Enable =
void>
436 typename T::value_type(), 0))>>
437 : std::is_convertible<decltype(std::declval<T>().data()),
438 const typename T::value_type*> {};
445# define FMT_UNICODE 1
449 "Unicode support requires compiling with /utf-8");
451template <
typename T>
constexpr const char*
narrow(
const T*) {
return nullptr; }
454template <
typename Char>
458 for (; n != 0; ++s1, ++s2, --n) {
459 if (*s1 < *s2)
return -1;
460 if (*s1 > *s2)
return 1;
468template <
typename Container>
470 ->
decltype(back_inserter(std::declval<Container&>()));
473template <
typename It,
typename Enable = std::true_type>
476template <
typename It>
479 decltype(adl::invoke_back_inserter<typename It::container_type>()),
480 It>
::value>> : std::true_type {};
483template <
typename OutputIt>
485 typename OutputIt::container_type& {
486 struct accessor : OutputIt {
488 using OutputIt::container;
490 return *accessor(it).container;
517 : data_(s), size_(count) {}
526#if FMT_HAS_BUILTIN(__buitin_strlen) || FMT_GCC_VERSION || FMT_CLANG_VERSION
527 if (std::is_same<Char, char>::value) {
539 template <
typename S,
541 typename S::value_type, Char>::value)>
543 : data_(s.data()), size_(s.size()) {}
546 constexpr auto data() const noexcept -> const Char* {
return data_; }
549 constexpr auto size() const noexcept ->
size_t {
return size_; }
552 constexpr auto end() const noexcept ->
iterator {
return data_ + size_; }
554 constexpr auto operator[](
size_t pos)
const noexcept ->
const Char& {
565 return size_ >= sv.size_ &&
detail::compare(data_, sv.data_, sv.size_) == 0;
568 return size_ >= 1 && *data_ == c;
578 if (result != 0)
return result;
579 return size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1);
584 return lhs.compare(rhs) == 0;
587 return lhs.compare(rhs) != 0;
590 return lhs.compare(rhs) < 0;
593 return lhs.compare(rhs) <= 0;
596 return lhs.compare(rhs) > 0;
599 return lhs.compare(rhs) >= 0;
606template <
typename T>
struct is_xchar : std::false_type {};
607template <>
struct is_xchar<wchar_t> : std::true_type {};
608template <>
struct is_xchar<char16_t> : std::true_type {};
609template <>
struct is_xchar<char32_t> : std::true_type {};
611template <>
struct is_xchar<char8_t> : std::true_type {};
616template <>
struct is_char<char> : std::true_type {};
631template <
typename OutputIt,
typename Char>
637template <
typename Char>
650template <
typename T,
typename Char =
char,
typename Enable =
void>
710 align_mask = 0x00038,
711 width_mask = 0x000C0,
712 precision_mask = 0x00300,
714 uppercase_mask = 0x01000,
715 alternate_mask = 0x02000,
716 localized_mask = 0x04000,
717 fill_size_mask = 0x38000,
723 fill_size_shift = 15,
728 size_t data_ = 1 << fill_size_shift;
731 char fill_data_[max_fill_size] = {
' '};
734 data_ = (data_ & ~fill_size_mask) | (size << fill_size_shift);
742 data_ = (data_ & ~type_mask) |
static_cast<unsigned>(t);
746 return static_cast<fmt::align
>((data_ & align_mask) >> align_shift);
749 data_ = (data_ & ~align_mask) | (
static_cast<unsigned>(a) << align_shift);
753 return static_cast<arg_id_kind>((data_ & width_mask) >> width_shift);
756 data_ = (data_ & ~width_mask) | (
static_cast<unsigned>(w) << width_shift);
760 return static_cast<arg_id_kind>((data_ & precision_mask) >>
764 data_ = (data_ & ~precision_mask) |
765 (
static_cast<unsigned>(p) << precision_shift);
769 return (data_ & (width_mask | precision_mask)) != 0;
773 return static_cast<fmt::sign
>((data_ & sign_mask) >> sign_shift);
776 data_ = (data_ & ~sign_mask) | (
static_cast<unsigned>(s) << sign_shift);
779 constexpr auto upper() const ->
bool {
return (data_ & uppercase_mask) != 0; }
782 constexpr auto alt() const ->
bool {
return (data_ & alternate_mask) != 0; }
787 return (data_ & localized_mask) != 0;
792 return (data_ & fill_size_mask) >> fill_size_shift;
795 template <
typename Char, FMT_ENABLE_IF(std::is_same<Char,
char>::value)>
796 constexpr auto fill() const -> const Char* {
799 template <
typename Char, FMT_ENABLE_IF(!std::is_same<Char,
char>::value)>
800 constexpr auto fill() const -> const Char* {
804 template <
typename Char>
constexpr auto fill_unit() const -> Char {
805 using uchar =
unsigned char;
806 return static_cast<Char
>(
static_cast<uchar
>(fill_data_[0]) |
807 (
static_cast<uchar
>(fill_data_[1]) << 8) |
808 (
static_cast<uchar
>(fill_data_[2]) << 16));
816 template <
typename Char>
818 auto size = s.
size();
822 fill_data_[0] =
static_cast<char>(uchar);
823 fill_data_[1] =
static_cast<char>(uchar >> 8);
824 fill_data_[2] =
static_cast<char>(uchar >> 16);
827 FMT_ASSERT(size <= max_fill_size,
"invalid fill");
828 for (
size_t i = 0; i < size; ++i)
829 fill_data_[i & 3] =
static_cast<char>(s[i]);
877 if (next_arg_id_ < 0) {
878 report_error(
"cannot switch from manual to automatic argument indexing");
881 int id = next_arg_id_++;
889 if (next_arg_id_ > 0) {
890 report_error(
"cannot switch from automatic to manual argument indexing");
909template <
typename Char, FMT_ENABLE_IF(is_
char<Char>::value)>
913template <
typename T, FMT_ENABLE_IF(is_std_
string_like<T>::value)>
918template <
typename Char>
924template <
typename T,
typename Enable =
void>
961template <
typename T,
typename Char>
964#define FMT_TYPE_CONSTANT(Type, constant) \
965 template <typename Char> \
966 struct type_constant<Type, Char> \
967 : std::integral_constant<type, type::constant> {}
991constexpr auto set(
type rhs) ->
int {
return 1 <<
static_cast<int>(rhs); }
992constexpr auto in(
type t,
int set) ->
bool {
993 return ((set >>
static_cast<int>(t)) & 1) != 0;
1013template <
typename Char,
typename T>
struct named_arg;
1017template <
typename Char,
typename T>
1028template <
bool B = false>
constexpr auto count() ->
int {
return B ? 1 : 0; }
1029template <
bool B1,
bool B2,
bool... Tail>
constexpr auto count() ->
int {
1030 return (B1 ? 1 : 0) +
count<B2, Tail...>();
1034 return count<is_named_arg<Args>::value...>();
1037 return count<is_static_named_arg<Args>::value...>();
1045template <
typename Char,
typename T, FMT_ENABLE_IF(!is_named_arg<T>::value)>
1049template <
typename Char,
typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>
1050void init_named_arg(named_arg_info<Char>* named_args,
int& arg_index,
1051 int& named_arg_index,
const T&
arg) {
1052 named_args[named_arg_index++] = {
arg.name, arg_index++};
1055template <
typename T,
typename Char,
1061template <
typename T,
typename Char,
1064 int& arg_index,
int& named_arg_index) {
1065 named_args[named_arg_index++] = {T::name, arg_index++};
1074template <
typename T>
1077template <
typename T>
1081template <
typename T,
typename Enable = std::true_type>
1084template <
typename T,
typename Enable = std::true_type>
1088template <
typename T>
1091 : std::true_type {};
1092template <
typename T>
1095 : std::true_type {};
1097template <
typename T,
typename U = remove_const_t<T>>
1099 bool_constant<(std::is_class<T>::value || std::is_enum<T>::value ||
1100 std::is_union<T>::value || std::is_array<T>::value) &&
1104template <
typename Char,
typename T,
typename U = remove_const_t<T>>
1117 static auto map(
signed char) -> int;
1118 static auto map(
unsigned char) -> unsigned;
1119 static auto map(
short) -> int;
1120 static auto map(
unsigned short) -> unsigned;
1122 static auto map(
unsigned) -> unsigned;
1125 static auto map(
long long) ->
long long;
1126 static auto map(
unsigned long long) ->
unsigned long long;
1129 static auto map(
bool) -> bool;
1137 template <
typename T, FMT_ENABLE_IF(is_
char<T>::value)>
1139 std::is_same<T, char>::value || std::is_same<T, Char>::value, Char,
void>;
1141 static auto map(
float) -> float;
1142 static auto map(
double) -> double;
1143 static auto map(
long double) ->
long double;
1145 static auto map(Char*) ->
const Char*;
1146 static auto map(
const Char*) ->
const Char*;
1147 template <
typename T,
typename C =
char_t<T>,
1148 FMT_ENABLE_IF(!std::is_po
inter<T>::value)>
1152 static auto map(
void*) ->
const void*;
1153 static auto map(
const void*) ->
const void*;
1154 static auto map(
volatile void*) ->
const void*;
1155 static auto map(
const volatile void*) ->
const void*;
1157 template <
typename T, FMT_ENABLE_IF(std::is_po
inter<T>::value ||
1158 std::is_member_po
inter<T>::value)>
1159 static auto map(
const T&) -> void;
1161 template <
typename T, FMT_ENABLE_IF(use_format_as<T>::value)>
1163 template <
typename T, FMT_ENABLE_IF(use_format_as_member<T>::value)>
1166 template <
typename T, FMT_ENABLE_IF(use_formatter<T>::value)>
1169 template <
typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>
1174template <
typename T,
typename Char>
1178template <
typename T,
typename Char =
char>
1181template <
typename T,
typename Context,
1188template <
typename Char>
1201 constexpr auto num_args() const ->
int {
return num_args_; }
1206 if (
id >= num_args_)
report_error(
"argument not found");
1212 if (
id >= num_args_)
report_error(
"argument not found");
1241template <
typename Char, FMT_ENABLE_IF(std::is_
integral<Char>::value)>
1243 return c <= 0xff ? static_cast<char>(c) :
'\0';
1247template <
typename Char>
1250 auto c =
static_cast<unsigned char>(*begin);
1251 return static_cast<int>((0x3a55000000000000ull >> (2 * (c >> 3))) & 3) + 1;
1256template <
typename Char>
1258 int error_value)
noexcept ->
int {
1259 FMT_ASSERT(begin != end &&
'0' <= *begin && *begin <=
'9',
"");
1260 unsigned value = 0, prev = 0;
1266 }
while (p != end &&
'0' <= *p && *p <=
'9');
1267 auto num_digits = p - begin;
1269 int digits10 =
static_cast<int>(
sizeof(int) * CHAR_BIT * 3 / 10);
1272 unsigned max = INT_MAX;
1273 return num_digits ==
digits10 + 1 &&
1274 prev * 10ull + unsigned(p[-1] -
'0') <= max
1275 ?
static_cast<int>(
value)
1289 return (
'a' <= c && c <=
'z') || (
'A' <= c && c <=
'Z') || c ==
'_';
1292template <
typename Char,
typename Handler>
1294 Handler&& handler) ->
const Char* {
1296 if (c >=
'0' && c <=
'9') {
1302 if (begin == end || (*begin !=
'}' && *begin !=
':'))
1305 handler.on_index(
index);
1315 }
while (it != end && (
is_name_start(*it) || (
'0' <= *it && *it <=
'9')));
1316 handler.on_name({begin,
to_unsigned(it - begin)});
1344template <
typename Char>
1351 if (
'0' <= *begin && *begin <=
'9') {
1356 if (*begin ==
'{') {
1360 if (c ==
'}' || c ==
':') {
1361 int id = ctx.next_arg_id();
1364 ctx.check_dynamic_spec(
id);
1370 if (begin != end && *begin ==
'}')
return {++begin, kind};
1374 return {begin, kind};
1377template <
typename Char>
1382 specs.set_dynamic_width(result.kind);
1386template <
typename Char>
1398 specs.set_dynamic_precision(result.kind);
1405template <
typename Char>
1411 if (end - begin > 1) {
1415 if (begin == end)
return begin;
1422 if (current_state >= s || !valid)
1435 FMT_CONSTEXPR auto operator()(pres pres_type,
int set) ->
const Char* {
1436 if (!
in(arg_type, set))
report_error(
"invalid format specifier");
1440 } parse_presentation_type{begin, specs, arg_type};
1467 report_error(
"format specifier requires numeric argument");
1471 specs.set_fill(
'0');
1476 case '1':
case '2':
case '3':
case '4':
case '5':
1477 case '6':
case '7':
case '8':
case '9':
case '{':
1480 begin =
parse_width(begin, end, specs, specs.width_ref, ctx);
1489 specs.set_localized();
1492 case 'd':
return parse_presentation_type(pres::dec, integral_set);
1494 case 'x':
return parse_presentation_type(pres::hex, integral_set);
1495 case 'o':
return parse_presentation_type(pres::oct, integral_set);
1497 case 'b':
return parse_presentation_type(pres::bin, integral_set);
1499 case 'e':
return parse_presentation_type(pres::exp,
float_set);
1501 case 'f':
return parse_presentation_type(pres::fixed,
float_set);
1503 case 'g':
return parse_presentation_type(pres::general,
float_set);
1505 case 'a':
return parse_presentation_type(pres::hexfloat,
float_set);
1508 return parse_presentation_type(pres::chr, integral_set);
1510 return parse_presentation_type(pres::string,
1515 return parse_presentation_type(pres::debug,
1517 case '}':
return begin;
1519 if (*begin ==
'}')
return begin;
1522 if (end - fill_end <= 0) {
1526 if (*begin ==
'{') {
1534 specs.set_align(alignment);
1535 begin = fill_end + 1;
1538 if (begin == end)
return begin;
1543template <
typename Char,
typename Handler>
1550 handler.on_error(
"invalid format string");
1556 handler.on_replacement_field(handler.on_arg_id(), begin);
1558 case '{': handler.on_text(begin, begin + 1);
return begin + 1;
1559 case ':': arg_id = handler.on_arg_id();
break;
1565 FMT_CONSTEXPR void on_index(
int id) { arg_id = handler.on_arg_id(
id); }
1567 arg_id = handler.on_arg_id(
id);
1569 } adapter = {handler, 0};
1571 arg_id = adapter.arg_id;
1572 Char c = begin != end ? *begin : Char();
1574 handler.on_replacement_field(arg_id, begin);
1578 handler.on_error(
"missing '}' in format string");
1584 begin = handler.on_format_specs(arg_id, begin + 1, end);
1585 if (begin == end || *begin !=
'}')
1586 return handler.on_error(
"unknown format specifier"), end;
1590template <
typename Char,
typename Handler>
1592 Handler&& handler) {
1593 auto begin = fmt.
data(), end = begin + fmt.
size();
1598 handler.on_text(begin, p - 1);
1600 }
else if (c ==
'}') {
1601 if (p == end || *p !=
'}')
1602 return handler.on_error(
"unmatched '}' in format string");
1603 handler.on_text(begin, p);
1607 handler.on_text(begin, end);
1612 auto type = specs.type();
1627template <
typename T,
typename Char>
1631 constexpr bool formattable =
1632 std::is_constructible<formatter<mapped_type, Char>>
::value;
1633 if (!formattable)
return ctx.begin();
1640template <
typename Char,
int NUM_ARGS,
int NUM_NAMED_ARGS,
bool DYNAMIC_NAMES>
1648 parse_func parse_funcs_[
max_of(1, NUM_ARGS)];
1651 template <
typename... T>
1656 context_(fmt, NUM_ARGS, types_),
1658 int arg_index = 0, named_arg_index = 0;
1672 for (
int i = 0; i < NUM_NAMED_ARGS; ++i) {
1673 if (named_args_[i].name ==
id)
return named_args_[i].
id;
1675 if (!DYNAMIC_NAMES)
on_error(
"argument not found");
1686 if (
id >= 0 &&
id < NUM_ARGS)
return parse_funcs_[id](context_);
1687 while (begin != end && *begin !=
'}') ++begin;
1711 : size_(sz), capacity_(sz), grow_(grow) {}
1713 constexpr buffer(grow_fun grow, T* p =
nullptr,
size_t sz = 0,
1714 size_t cap = 0) noexcept
1715 : ptr_(p), size_(sz), capacity_(cap), grow_(grow) {}
1723 capacity_ = buf_capacity;
1733 auto begin() noexcept -> T* {
return ptr_; }
1734 auto end() noexcept -> T* {
return ptr_ + size_; }
1736 auto begin() const noexcept -> const T* {
return ptr_; }
1737 auto end() const noexcept -> const T* {
return ptr_ + size_; }
1740 constexpr auto size() const noexcept ->
size_t {
return size_; }
1743 constexpr auto capacity() const noexcept ->
size_t {
return capacity_; }
1764 if (new_capacity > capacity_) grow_(*
this, new_capacity);
1769 ptr_[size_++] =
value;
1773 template <
typename U>
1776#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1940
1781 while (begin != end) {
1784 auto free_cap = capacity_ - size_;
1787 T* out = ptr_ + size_;
1788 for (
size_t i = 0; i <
count; ++i) out[i] = begin[i];
1797 template <
typename Idx>
1805 constexpr auto count() const ->
size_t {
return 0; }
1806 constexpr auto limit(
size_t size)
const ->
size_t {
return size; }
1816 constexpr auto count() const ->
size_t {
return count_; }
1818 size_t n = limit_ > count_ ? limit_ - count_ : 0;
1825template <
typename OutputIt,
typename T,
typename Traits = buffer_traits>
1829 enum { buffer_size = 256 };
1830 T data_[buffer_size];
1837 auto size = this->
size();
1839 const T* begin = data_;
1840 const T* end = begin + this->
limit(size);
1841 while (begin != end) *out_++ = *begin++;
1846 : Traits(n),
buffer<T>(grow, data_, 0, buffer_size), out_(out) {}
1861 auto count() const ->
size_t {
return Traits::count() + this->
size(); }
1864template <
typename T>
1869 enum { buffer_size = 256 };
1870 T data_[buffer_size];
1878 size_t n = this->limit(this->size());
1879 if (this->data() == out_) {
1881 this->
set(data_, buffer_size);
1893 if (this->data() != out_) {
1894 this->
set(data_, buffer_size);
1912 :
buffer<T>([](
buffer<T>&, size_t) {}, out, 0, ~size_t()) {}
1914 auto out() -> T* {
return &*this->end(); }
1917template <
typename Container>
1920 using value_type =
typename Container::value_type;
1925 self.set(&self.container[0],
capacity);
1936template <
typename OutputIt>
1941 typename OutputIt::container_type::value_type>>
1951 auto out() -> OutputIt {
return OutputIt(this->container); }
1957 enum { buffer_size = 256 };
1958 T data_[buffer_size];
1962 if (buf.
size() != buffer_size)
return;
1970 constexpr auto count() const noexcept ->
size_t {
1971 return count_ + this->
size();
1975template <
typename T>
1978template <
typename OutputIt,
typename InputIt,
typename =
void>
1980template <
typename OutputIt,
typename InputIt>
1984 .append(std::declval<InputIt>(),
1985 std::declval<InputIt>()))>> : std::true_type {};
1988template <
typename T,
typename InputIt,
typename OutputIt,
1998template <
typename T,
typename InputIt,
typename OutputIt,
2000 !has_back_insert_iterator_container_append<
2005 c.insert(c.end(), begin, end);
2009template <
typename T,
typename InputIt,
typename OutputIt,
2012 while (begin != end) *out++ =
static_cast<T
>(*begin++);
2016template <
typename T,
typename V,
typename OutputIt>
2018 return copy<T>(s.begin(), s.end(), out);
2021template <
typename It,
typename Enable = std::true_type>
2023template <
typename It>
2027 std::is_base_of<buffer<typename It::container_type::value_type>,
2028 typename It::container_type>
::value>>
2029 : std::true_type {};
2032template <
typename T,
typename OutputIt,
2037template <
typename T,
typename OutputIt,
2043template <
typename Buf,
typename OutputIt>
2047template <
typename T,
typename OutputIt>
2074#if !FMT_BUILTIN_TYPES
2075# define FMT_BUILTIN , monostate
2081template <
typename Context>
class value {
2123 static_assert(N <= 64,
"unsupported _BitInt");
2127 static_assert(N <= 64,
"unsupported _BitInt");
2130 template <
typename T, FMT_ENABLE_IF(is_
char<T>::value)>
2133 std::is_same<T, char>::value || std::is_same<T, char_type>::value,
2134 "mixing character types is disallowed");
2149 template <
typename T,
typename C =
char_t<T>,
2150 FMT_ENABLE_IF(!std::is_po
inter<T>::value)>
2152 static_assert(std::is_same<C, char_type>::value,
2153 "mixing character types is disallowed");
2155 string.data = sv.data();
2156 string.size = sv.size();
2161 :
pointer(const_cast<const void*>(x)) {}
2163 :
pointer(const_cast<const void*>(x)) {}
2166 template <
typename T, FMT_ENABLE_IF(std::is_po
inter<T>::value ||
2167 std::is_member_po
inter<T>::value)>
2172 static_assert(
sizeof(T) == 0,
2173 "formatting of non-void pointers is disallowed");
2176 template <
typename T, FMT_ENABLE_IF(use_format_as<T>::value)>
2178 template <
typename T, FMT_ENABLE_IF(use_format_as_member<T>::value)>
2181 template <
typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>
2184 template <
typename T,
2192 template <typename T, FMT_ENABLE_IF(has_formatter<T, char_type>())>
2198 const_cast<char*
>(&
reinterpret_cast<const volatile char&
>(x));
2201#if defined(__cpp_if_constexpr)
2203 custom.value =
const_cast<value_type*
>(&x);
2206 custom.format = format_custom<value_type, formatter<value_type, char_type>>;
2209 template <typename T, FMT_ENABLE_IF(!has_formatter<T, char_type>())>
2213 type_is_unformattable_for<T, char_type> _;
2217 template <
typename T,
typename Formatter>
2220 auto f = Formatter();
2222 using qualified_type =
2226 ctx.advance_to(cf.format(*
static_cast<qualified_type*
>(
arg), ctx));
2236template <
typename It,
typename T,
typename Enable =
void>
2241template <
typename It,
typename T>
2244 void_t<decltype(*std::declval<decay_t<It>&>()++ = std::declval<T>())>>
2245 :
std::true_type {};
2247#ifndef FMT_USE_LOCALE
2248# define FMT_USE_LOCALE (FMT_OPTIMIZE_SIZE <= 1)
2255 const void* locale_;
2260 template <
typename Locale, FMT_ENABLE_IF(sizeof(Locale::collate) != 0)>
2263 inline explicit operator bool()
const noexcept {
return locale_ !=
nullptr; }
2266 template <
typename Locale>
auto get()
const -> Locale;
2273template <
typename Context,
typename Arg,
typename... Args>
2279template <
typename Context,
typename... T,
size_t NUM_ARGS =
sizeof...(T)>
2285template <
typename Context,
int NUM_ARGS>
2289template <
typename Context,
int NUM_ARGS,
int NUM_NAMED_ARGS,
2290 unsigned long long DESC>
2296 template <
typename... T>
2299 int arg_index = 0, named_arg_index = 0;
2305 args[0] = {named_args, NUM_NAMED_ARGS};
2306 for (
size_t i = 1; i <
sizeof(args) /
sizeof(*args); ++i)
2307 args[i] = rhs.args[i];
2308 for (
size_t i = 0; i < NUM_NAMED_ARGS; ++i)
2309 named_args[i] = rhs.named_args[i];
2321template <
typename Context,
int NUM_ARGS,
int NUM_NAMED_ARGS,
2322 unsigned long long DESC>
2341 if (ctx.begin() == ctx.end() || *ctx.begin() ==
'}')
return ctx.begin();
2347 template <
type U = TYPE,
2348 FMT_ENABLE_IF(U == type::string_type || U == type::cstring_type ||
2349 U == type::char_type)>
2355 template <
typename FormatContext>
2357 ->
decltype(ctx.out());
2360template <
typename T,
typename Enable =
void>
2362 :
bool_constant<mapped_type_constant<T>::value == type::custom_type> {};
2363template <
typename T>
2365 : std::false_type {};
2370template <
typename T1,
typename T2,
typename... Tail>
2376 locale_ref loc = {});
2387template <
typename Char>
2393 if (arg_id >= ctx->num_args())
report_error(
"argument not found");
2397template <
typename Char>
2401 static_cast<compile_parse_context<Char>*
>(
this)->check_dynamic_spec(arg_id);
2435 using char_type =
typename Context::char_type;
2452 : value_(args, size) {}
2453 template <
typename T>
2455 : value_(val), type_(
detail::stored_type_constant<T, Context>::value) {}
2457 constexpr explicit operator bool() const noexcept {
2467 template <
typename Visitor>
2496 value_.
custom.format(value_.
custom.value, parse_ctx, ctx);
2515 unsigned long long desc_;
2526 constexpr auto is_packed() const ->
bool {
2529 constexpr auto has_named_args() const ->
bool {
2536 return static_cast<detail::type>((desc_ >> shift) & mask);
2539 template <
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC>
2549 template <
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC,
2553 : desc_(DESC | (NUM_NAMED_ARGS != 0 ? +
detail::has_named_args_bit : 0)),
2556 template <
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC,
2559 : desc_(DESC | (NUM_NAMED_ARGS != 0 ? +
detail::has_named_args_bit : 0)),
2564 bool has_named =
false)
2565 : desc_(
detail::is_unpacked_bit |
detail::to_unsigned(count) |
2566 (has_named ? +
detail::has_named_args_bit : 0)),
2577 arg.type_ = type(
id);
2582 template <
typename Char>
2588 template <
typename Char>
2590 if (!has_named_args())
return -1;
2591 const auto& named_args =
2592 (is_packed() ?
values_[-1] :
args_[-1].value_).named_args;
2593 for (
size_t i = 0; i < named_args.size; ++i) {
2594 if (named_args.data[i].name == name)
return named_args.data[i].id;
2601 return static_cast<int>(is_packed() ? max_packed
2602 : desc_ &
~detail::is_unpacked_bit);
2626 : locale_ref(loc), out_(out), args_(args) {}
2633 return args_.
get(name);
2636 return args_.
get_id(name);
2665 static constexpr int num_static_named_args =
2669 char,
static_cast<int>(
sizeof...(T)), num_static_named_args,
2682 static_assert(count<(std::is_base_of<view, remove_reference_t<T>>::value &&
2683 std::is_reference<T>::value)...>() == 0,
2684 "passing views as lvalues is disallowed");
2686#ifdef FMT_ENFORCE_COMPILE_STRING
2689 "FMT_ENFORCE_COMPILE_STRING requires format strings to use FMT_STRING");
2692 template <
typename S,
2693 FMT_ENABLE_IF(std::is_convertible<const S&, string_view>::value)>
2698#ifdef FMT_ENFORCE_COMPILE_STRING
2701 "FMT_ENFORCE_COMPILE_STRING requires format strings to use FMT_STRING");
2704 template <
typename S,
2705 FMT_ENABLE_IF(std::is_base_of<detail::compile_string, S>::value&&
2706 std::is_same<typename S::char_type, char>::value)>
2722template <
typename T,
typename Char =
char>
2726#ifdef __cpp_concepts
2727template <
typename T,
typename Char =
char>
2731template <
typename T,
typename Char>
2735template <
typename T,
typename Char>
2749template <
typename Context =
context,
typename... T,
2750 int NUM_ARGS =
sizeof...(T),
2760template <
typename... T>
2774template <
typename Char,
typename T>
2780template <
typename OutputIt,
2800template <
typename OutputIt,
typename... T,
2815template <
typename OutputIt,
typename... T,
2822 return {buf.out(), buf.count()};
2831template <
typename OutputIt,
typename... T,
2855 return {result.out, result.size > N};
2858template <
size_t N,
typename... T>
2862 return {result.out, result.size > N};
2866template <
typename... T>
2868 T&&... args) ->
size_t {
2887template <
typename... T>
2889 vargs<T...> va = {{args...}};
2904template <
typename... T>
2906 vargs<T...> va = {{args...}};
2910 :
vprint(f, fmt.str, va);
2915template <
typename... T>
2917 vargs<T...> va = {{args...}};
2925template <
typename... T>
2927 return fmt::println(stdout, fmt,
static_cast<T&&
>(args)...);
2935#ifdef FMT_HEADER_ONLY
constexpr auto format_as(HAL_AddressableLEDColorOrder order)
Definition AddressableLEDTypes.h:34
FMT_CONSTEXPR20 auto operator=(T c) -> basic_appender &
Definition base.h:2417
FMT_CONSTEXPR20 auto operator++(int) -> basic_appender
Definition base.h:2423
detail::buffer< T > * container
Definition base.h:2410
FMT_CONSTEXPR20 auto operator++() -> basic_appender &
Definition base.h:2422
FMT_CONSTEXPR20 auto operator*() -> basic_appender &
Definition base.h:2421
FMT_CONSTEXPR basic_appender(detail::buffer< T > &buf)
Definition base.h:2415
constexpr bool dynamic() const
Definition base.h:768
FMT_CONSTEXPR void set_fill(char c)
Definition base.h:811
constexpr auto align() const -> align
Definition base.h:745
FMT_CONSTEXPR void set_dynamic_precision(arg_id_kind p)
Definition base.h:763
FMT_CONSTEXPR auto dynamic_precision() const -> arg_id_kind
Definition base.h:759
FMT_CONSTEXPR void set_fill(basic_string_view< Char > s)
Definition base.h:817
constexpr auto sign() const -> sign
Definition base.h:772
FMT_CONSTEXPR void set_alt()
Definition base.h:783
constexpr auto localized() const -> bool
Definition base.h:786
FMT_CONSTEXPR void set_sign(fmt::sign s)
Definition base.h:775
constexpr auto upper() const -> bool
Definition base.h:779
FMT_CONSTEXPR void clear_alt()
Definition base.h:784
constexpr auto type() const -> presentation_type
Definition base.h:738
constexpr auto fill() const -> const Char *
Definition base.h:796
FMT_CONSTEXPR void set_upper()
Definition base.h:780
constexpr auto alt() const -> bool
Definition base.h:782
constexpr auto dynamic_width() const -> arg_id_kind
Definition base.h:752
constexpr auto fill_unit() const -> Char
Definition base.h:804
FMT_CONSTEXPR void set_align(fmt::align a)
Definition base.h:748
FMT_CONSTEXPR void set_type(presentation_type t)
Definition base.h:741
FMT_CONSTEXPR void set_dynamic_width(arg_id_kind w)
Definition base.h:755
constexpr auto fill_size() const -> size_t
Definition base.h:791
FMT_CONSTEXPR void set_localized()
Definition base.h:789
An implementation of std::basic_string_view for pre-C++17.
Definition base.h:504
constexpr auto end() const noexcept -> iterator
Definition base.h:552
const Char * iterator
Definition base.h:511
constexpr auto size() const noexcept -> size_t
Returns the string size.
Definition base.h:549
constexpr basic_string_view(nullptr_t)=delete
FMT_CONSTEXPR basic_string_view(const S &s) noexcept
Constructs a string reference from a std::basic_string or a std::basic_string_view object.
Definition base.h:542
constexpr auto data() const noexcept -> const Char *
Returns a pointer to the string data.
Definition base.h:546
friend auto operator>(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:595
FMT_CONSTEXPR auto starts_with(Char c) const noexcept -> bool
Definition base.h:567
constexpr auto begin() const noexcept -> iterator
Definition base.h:551
friend auto operator<(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:589
Char value_type
Definition base.h:510
FMT_CONSTEXPR auto starts_with(const Char *s) const -> bool
Definition base.h:570
friend auto operator<=(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:592
FMT_CONSTEXPR void remove_prefix(size_t n) noexcept
Definition base.h:558
FMT_CONSTEXPR friend auto operator==(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:582
friend auto operator!=(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:586
constexpr auto operator[](size_t pos) const noexcept -> const Char &
Definition base.h:554
constexpr basic_string_view(const Char *s, size_t count) noexcept
Constructs a string reference object from a C string and a size.
Definition base.h:516
FMT_CONSTEXPR20 basic_string_view(const Char *s)
Constructs a string reference object from a C string.
Definition base.h:525
FMT_CONSTEXPR auto starts_with(basic_string_view< Char > sv) const noexcept -> bool
Definition base.h:563
constexpr basic_string_view() noexcept
Definition base.h:513
friend auto operator>=(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:598
FMT_CONSTEXPR auto compare(basic_string_view other) const -> int
Definition base.h:575
FMT_CONSTEXPR void advance_to(iterator)
Definition base.h:2643
void operator=(const context &)=delete
FMT_CONSTEXPR auto locale() const -> detail::locale_ref
Definition base.h:2645
FMT_CONSTEXPR auto arg_id(string_view name) const -> int
Definition base.h:2635
context(context &&)=default
char char_type
The character type for the output.
Definition base.h:2614
FMT_CONSTEXPR context(iterator out, format_args args, detail::locale_ref loc={})
Constructs a context object.
Definition base.h:2624
@ builtin_types
Definition base.h:2620
FMT_CONSTEXPR auto out() const -> iterator
Definition base.h:2640
auto arg(string_view name) const -> format_arg
Definition base.h:2632
context(const context &)=delete
FMT_CONSTEXPR auto arg(int id) const -> format_arg
Definition base.h:2631
A contiguous memory buffer with an optional growing ability.
Definition base.h:1698
FMT_CONSTEXPR buffer(grow_fun grow, size_t sz) noexcept
Definition base.h:1710
auto end() const noexcept -> const T *
Definition base.h:1737
FMT_CONSTEXPR20 void append(const U *begin, const U *end)
Appends data to the end of the buffer.
Definition base.h:1780
auto begin() const noexcept -> const T *
Definition base.h:1736
FMT_CONSTEXPR void push_back(const T &value)
Definition base.h:1767
T value_type
Definition base.h:1727
FMT_CONSTEXPR void set(T *buf_data, size_t buf_capacity) noexcept
Sets the buffer data and capacity.
Definition base.h:1721
FMT_CONSTEXPR auto operator[](Idx index) const -> const T &
Definition base.h:1798
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition base.h:1740
FMT_CONSTEXPR void try_reserve(size_t new_capacity)
Definition base.h:1763
FMT_CONSTEXPR auto data() const noexcept -> const T *
Definition base.h:1747
constexpr buffer(grow_fun grow, T *p=nullptr, size_t sz=0, size_t cap=0) noexcept
Definition base.h:1713
buffer(const buffer &)=delete
auto end() noexcept -> T *
Definition base.h:1734
FMT_CONSTEXPR void try_resize(size_t count)
Definition base.h:1754
constexpr auto capacity() const noexcept -> size_t
Returns the capacity of this buffer.
Definition base.h:1743
FMT_CONSTEXPR20 ~buffer()=default
auto begin() noexcept -> T *
Definition base.h:1733
const T & const_reference
Definition base.h:1728
FMT_CONSTEXPR auto operator[](Idx index) -> T &
Definition base.h:1794
void operator=(const buffer &)=delete
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data (not null-terminated).
Definition base.h:1746
buffer(buffer &&)=default
FMT_CONSTEXPR void clear()
Clears this buffer.
Definition base.h:1750
constexpr auto num_args() const -> int
Definition base.h:1201
FMT_CONSTEXPR compile_parse_context(basic_string_view< Char > fmt, int num_args, const type *types, int next_arg_id=0)
Definition base.h:1196
FMT_CONSTEXPR auto next_arg_id() -> int
Definition base.h:1204
FMT_CONSTEXPR void check_arg_id(int id)
Definition base.h:1210
constexpr auto arg_type(int id) const -> type
Definition base.h:1202
FMT_CONSTEXPR void check_dynamic_spec(int arg_id)
Definition base.h:1216
Container & container
Definition base.h:1929
container_buffer(Container &c)
Definition base.h:1931
FMT_CONSTEXPR counting_buffer()
Definition base.h:1968
constexpr auto count() const noexcept -> size_t
Definition base.h:1970
constexpr auto count() const -> size_t
Definition base.h:1816
constexpr fixed_buffer_traits(size_t limit)
Definition base.h:1815
FMT_CONSTEXPR auto limit(size_t size) -> size_t
Definition base.h:1817
iterator_buffer(OutputIt out, size_t=0)
Definition base.h:1948
iterator_buffer(typename OutputIt::container_type &c)
Definition base.h:1947
auto out() -> OutputIt
Definition base.h:1951
~iterator_buffer()
Definition base.h:1898
auto count() const -> size_t
Definition base.h:1904
iterator_buffer(T *out, size_t n=buffer_size)
Definition base.h:1887
auto out() -> T *
Definition base.h:1900
iterator_buffer(iterator_buffer &&other) noexcept
Definition base.h:1889
auto out() -> T *
Definition base.h:1914
iterator_buffer(T *out, size_t=0)
Definition base.h:1911
iterator_buffer(iterator_buffer &&other) noexcept
Definition base.h:1847
iterator_buffer(OutputIt out, size_t n=buffer_size)
Definition base.h:1845
auto count() const -> size_t
Definition base.h:1861
~iterator_buffer()
Definition base.h:1851
auto out() -> OutputIt
Definition base.h:1857
int int_value
Definition base.h:2087
FMT_INLINE value(long double x FMT_BUILTIN)
Definition base.h:2139
value(const T &)
Definition base.h:2168
uint128_opt uint128_value
Definition base.h:2092
bool bool_value
Definition base.h:2093
FMT_INLINE value(uint128_opt x FMT_BUILTIN)
Definition base.h:2118
value(const T &named_arg)
Definition base.h:2182
constexpr FMT_INLINE value(bitint< N > x FMT_BUILTIN)
Definition base.h:2122
constexpr FMT_INLINE value(T x FMT_BUILTIN)
Definition base.h:2131
unsigned long long ulong_long_value
Definition base.h:2090
double double_value
Definition base.h:2096
FMT_CONSTEXPR FMT_INLINE value(unsigned long x FMT_BUILTIN)
Definition base.h:2112
constexpr FMT_INLINE value(int x)
Definition base.h:2109
long double long_double_value
Definition base.h:2097
FMT_CONSTEXPR FMT_INLINE value(const char_type *x FMT_BUILTIN)
Definition base.h:2145
constexpr FMT_INLINE value(double x FMT_BUILTIN)
Definition base.h:2138
FMT_INLINE value(const volatile void *x FMT_BUILTIN)
Definition base.h:2162
FMT_INLINE value(const void *x FMT_BUILTIN)
Definition base.h:2159
constexpr FMT_INLINE value(unsigned long long x FMT_BUILTIN)
Definition base.h:2115
FMT_CONSTEXPR20 FMT_INLINE value(T &x)
Definition base.h:2186
FMT_CONSTEXPR FMT_INLINE value(char_type *x FMT_BUILTIN)
Definition base.h:2141
FMT_CONSTEXPR value(const T &x FMT_BUILTIN)
Definition base.h:2151
float float_value
Definition base.h:2095
constexpr FMT_INLINE value()
Definition base.h:2104
constexpr FMT_INLINE value(float x FMT_BUILTIN)
Definition base.h:2137
int128_opt int128_value
Definition base.h:2091
FMT_CONSTEXPR FMT_INLINE value(long x FMT_BUILTIN)
Definition base.h:2111
constexpr FMT_INLINE value(unsigned char x FMT_BUILTIN)
Definition base.h:2106
FMT_INLINE value(volatile void *x FMT_BUILTIN)
Definition base.h:2160
custom_value< Context > custom
Definition base.h:2100
FMT_ALWAYS_INLINE value(const named_arg_info< char_type > *args, size_t size)
Definition base.h:2188
constexpr FMT_INLINE value(ubitint< N > x FMT_BUILTIN)
Definition base.h:2126
named_arg_value< char_type > named_args
Definition base.h:2101
constexpr FMT_INLINE value(signed char x)
Definition base.h:2105
constexpr FMT_INLINE value(unsigned x FMT_BUILTIN)
Definition base.h:2110
FMT_INLINE value(int128_opt x FMT_BUILTIN)
Definition base.h:2117
constexpr FMT_INLINE value(long long x FMT_BUILTIN)
Definition base.h:2114
char_type char_value
Definition base.h:2094
string_value< char_type > string
Definition base.h:2099
typename Context::char_type char_type
Definition base.h:2083
monostate no_value
Definition base.h:2086
FMT_INLINE value(void *x FMT_BUILTIN)
Definition base.h:2158
constexpr FMT_INLINE value(unsigned short x FMT_BUILTIN)
Definition base.h:2108
const void * pointer
Definition base.h:2098
value(const T &x)
Definition base.h:2177
unsigned uint_value
Definition base.h:2088
FMT_INLINE value(nullptr_t)
Definition base.h:2164
constexpr FMT_INLINE value(bool x FMT_BUILTIN)
Definition base.h:2119
long long long_long_value
Definition base.h:2089
constexpr FMT_INLINE value(signed short x)
Definition base.h:2107
Parsing context consisting of a format string range being parsed and an argument counter for automati...
Definition base.h:845
const Char * iterator
Definition base.h:856
constexpr auto begin() const noexcept -> iterator
Returns an iterator to the beginning of the format string range being parsed.
Definition base.h:864
FMT_CONSTEXPR void check_arg_id(basic_string_view< Char >)
Definition base.h:896
FMT_CONSTEXPR void check_dynamic_spec(int arg_id)
Definition base.h:2398
FMT_CONSTEXPR void check_arg_id(int id)
Reports an error if using the automatic argument indexing; otherwise switches to the manual indexing.
Definition base.h:888
FMT_CONSTEXPR auto next_arg_id() -> int
Reports an error if using the manual argument indexing; otherwise returns the next argument index and...
Definition base.h:876
constexpr parse_context(basic_string_view< Char > fmt, int next_arg_id=0)
Definition base.h:858
FMT_CONSTEXPR void advance_to(iterator it)
Advances the begin iterator to it.
Definition base.h:870
Char char_type
Definition base.h:855
constexpr auto end() const noexcept -> iterator
Returns an iterator past the end of the format string range being parsed.
Definition base.h:867
auto invoke_back_inserter() -> decltype(back_inserter(std::declval< Container & >()))
detail namespace with internal helper functions
Definition input_adapters.h:32
FMT_CONSTEXPR auto code_point_length(const Char *begin) -> int
Definition base.h:1248
auto get_iterator(Buf &buf, OutputIt) -> decltype(buf.out())
Definition base.h:2044
conditional_t< long_short, int, long long > long_type
Definition base.h:1071
FMT_CONSTEXPR auto is_locking() -> bool
Definition base.h:2367
constexpr auto to_ascii(Char c) -> char
Definition base.h:1242
FMT_CONSTEXPR auto parse_dynamic_spec(const Char *begin, const Char *end, int &value, arg_ref< Char > &ref, parse_context< Char > &ctx) -> parse_dynamic_spec_result< Char >
Definition base.h:1345
FMT_CONSTEXPR auto compare(const Char *s1, const Char *s2, std::size_t n) -> int
Definition base.h:455
@ long_short
Definition base.h:1070
FMT_CONSTEXPR void ignore_unused(const T &...)
Definition base.h:348
constexpr auto count_static_named_args() -> int
Definition base.h:1036
void vprint_mojibake(FILE *, string_view, const format_args &, bool)
Definition base.h:2381
FMT_CONSTEXPR auto parse_precision(const Char *begin, const Char *end, format_specs &specs, arg_ref< Char > &precision_ref, parse_context< Char > &ctx) -> const Char *
Definition base.h:1387
void init_named_arg(named_arg_info< Char > *, int &arg_index, int &, const T &)
Definition base.h:1046
uint128_opt
Definition base.h:401
constexpr auto is_integral_type(type t) -> bool
Definition base.h:984
constexpr auto count_named_args() -> int
Definition base.h:1033
FMT_CONSTEXPR auto parse_nonnegative_int(const Char *&begin, const Char *end, int error_value) noexcept -> int
Definition base.h:1257
constexpr auto digits10() noexcept -> int
Definition format.h:1125
FMT_CONSTEXPR void init_static_named_arg(named_arg_info< Char > *, int &arg_index, int &)
Definition base.h:1057
FMT_CONSTEXPR auto invoke_parse(parse_context< Char > &ctx) -> const Char *
Definition base.h:1629
conditional_t< long_short, unsigned, unsigned long long > ulong_type
Definition base.h:1072
@ is_unpacked_bit
Definition base.h:2233
@ has_named_args_bit
Definition base.h:2234
typename std::enable_if< B, T >::type enable_if_t
Definition cpp_future.h:38
int128_opt
Definition base.h:400
@ value
the parser finished reading a JSON value
FMT_CONSTEXPR auto to_unsigned(Int value) -> make_unsigned_t< Int >
Definition base.h:422
auto has_formatter_impl(T *p, buffered_context< Char > *ctx=nullptr) -> decltype(formatter< U, Char >().format(*p, *ctx), std::true_type())
constexpr auto is_name_start(Char c) -> bool
Definition base.h:1288
@ is_utf8_enabled
Definition base.h:441
constexpr auto in(type t, int set) -> bool
Definition base.h:992
FMT_CONSTEXPR auto check_char_specs(const format_specs &specs) -> bool
Definition base.h:1611
auto map(int128_opt) -> monostate
Definition base.h:403
@ bool_set
Definition base.h:1002
@ uint_set
Definition base.h:1000
@ pointer_set
Definition base.h:1008
@ float_set
Definition base.h:1004
@ cstring_set
Definition base.h:1007
@ char_set
Definition base.h:1003
@ sint_set
Definition base.h:998
@ string_set
Definition base.h:1006
constexpr auto is_constant_evaluated(bool default_value=false) noexcept -> bool
Definition base.h:350
@ max_packed_args
Definition base.h:2232
constexpr const char * narrow(const T *)
Definition base.h:451
constexpr auto is_arithmetic_type(type t) -> bool
Definition base.h:987
@ use_utf8
Definition base.h:442
FMT_ALWAYS_INLINE constexpr auto const_check(T val) -> T
Definition base.h:367
@ packed_arg_bits
Definition base.h:2230
FMT_CONSTEXPR void parse_format_string(basic_string_view< Char > fmt, Handler &&handler)
Definition base.h:1591
FMT_CONSTEXPR auto parse_width(const Char *begin, const Char *end, format_specs &specs, arg_ref< Char > &width_ref, parse_context< Char > &ctx) -> const Char *
Definition base.h:1378
FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt
Definition base.h:1992
typename make_void< Ts... >::type void_t
Definition void_t.h:21
decltype(detail::type_mapper< Char >::map(std::declval< T & >())) mapped_t
Definition base.h:1175
FMT_CONSTEXPR auto parse_align(const Char *begin, const Char *end, format_specs &specs) -> const Char *
Definition format.h:2184
remove_cvref_t< decltype(format_as(std::declval< const T & >()))> format_as_result
Definition base.h:1075
typename V::value_type char_t
String's character (code unit) type. detail:: is intentional to prevent ADL.
Definition base.h:935
constexpr auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition base.h:910
FMT_CONSTEXPR auto parse_arg_id(const Char *begin, const Char *end, Handler &&handler) -> const Char *
Definition base.h:1293
std::integral_constant< bool, Value > bool_constant
Definition type_traits.h:743
state
Definition base.h:1402
conditional_t< NUM_ARGS<=max_packed_args, value< Context >, basic_format_arg< Context > > arg_t
Definition base.h:2286
type
Definition base.h:937
auto get_buffer(OutputIt out) -> iterator_buffer< OutputIt, T >
Definition base.h:2034
FMT_CONSTEXPR FMT_INLINE auto parse_replacement_field(const Char *begin, const Char *end, Handler &&handler) -> const Char *
Definition base.h:1544
constexpr auto count() -> int
Definition base.h:1028
bool_constant<(std::is_class< T >::value||std::is_enum< T >::value|| std::is_union< T >::value||std::is_array< T >::value) && !has_to_string_view< T >::value &&!is_named_arg< T >::value && !use_format_as< T >::value &&!use_format_as_member< T >::value > use_formatter
Definition base.h:1098
constexpr auto has_formatter() -> bool
Definition base.h:1110
constexpr auto make_descriptor() -> unsigned long long
Definition base.h:2280
remove_cvref_t< decltype(formatter< T >::format_as(std::declval< const T & >()))> format_as_member_result
Definition base.h:1078
void vformat_to(buffer< Char > &buf, basic_string_view< Char > fmt, typename vformat_args< Char >::type args, locale_ref loc={})
Definition format.h:3665
conditional_t< sizeof(Char)==1, unsigned char, unsigned > unsigned_char
Definition base.h:428
constexpr auto encode_types() -> unsigned long long
Definition base.h:2269
FMT_FUNC void assert_fail(const char *file, int line, const char *message)
Definition format-inl.h:36
std::integral_constant< type, Context::builtin_types||TYPE==type::int_type ? TYPE :type::custom_type > stored_type_constant
Definition base.h:1184
FMT_CONSTEXPR20 auto get_container(OutputIt it) -> typename OutputIt::container_type &
Definition base.h:484
FMT_CONSTEXPR auto parse_format_specs(const Char *begin, const Char *end, dynamic_format_specs< Char > &specs, parse_context< Char > &ctx, type arg_type) -> const Char *
Definition base.h:1406
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
constexpr buffer_traits(size_t)
Definition base.h:1804
constexpr auto limit(size_t size) const -> size_t
Definition base.h:1806
constexpr auto count() const -> size_t
Definition base.h:1805
void(* format)(void *arg, parse_context< char_type > &parse_ctx, Context &ctx)
Definition base.h:2064
typename Context::char_type char_type
Definition base.h:2062
void * value
Definition base.h:2063
arg_ref< Char > & ref
Definition base.h:1322
FMT_CONSTEXPR void on_index(int id)
Definition base.h:1325
FMT_CONSTEXPR void on_name(basic_string_view< Char > id)
Definition base.h:1331
arg_id_kind & kind
Definition base.h:1323
parse_context< Char > & ctx
Definition base.h:1321
auto get() const -> Locale
Definition format-inl.h:101
Definition format-inl.h:92
int id
Definition base.h:1042
const Char * name
Definition base.h:1041
named_arg_info< typename Context::char_type > named_args[NUM_NAMED_ARGS]
Definition base.h:2294
FMT_CONSTEXPR FMT_ALWAYS_INLINE named_arg_store(T &... values)
Definition base.h:2297
named_arg_store(named_arg_store &&rhs)
Definition base.h:2304
named_arg_store & operator=(const named_arg_store &rhs)=delete
named_arg_store(const named_arg_store &rhs)=delete
named_arg_store & operator=(named_arg_store &&rhs)=delete
arg_t< Context, NUM_ARGS > args[1+NUM_ARGS]
Definition base.h:2293
const named_arg_info< Char > * data
Definition base.h:2068
size_t size
Definition base.h:2069
const T & value
Definition base.h:1022
const Char * name
Definition base.h:1021
named_arg(const Char *n, const T &v)
Definition base.h:1024
const Char * end
Definition base.h:1339
arg_id_kind kind
Definition base.h:1340
const Char * data
Definition base.h:2056
auto str() const -> basic_string_view< Char >
Definition base.h:2058
size_t size
Definition base.h:2057
static auto map(signed char) -> int
static auto map(unsigned short) -> unsigned
static auto map(Char *) -> const Char *
static auto map(const volatile void *) -> const void *
static auto map(unsigned char) -> unsigned
static auto map(const T &) -> conditional_t< std::is_same< C, Char >::value, basic_string_view< C >, void >
static auto map(const void *) -> const void *
static auto map(long long) -> long long
static auto map(T) -> conditional_t< std::is_same< T, char >::value||std::is_same< T, Char >::value, Char, void >
static auto map(const T &named_arg) -> decltype(map(named_arg.value))
static auto map(unsigned long long) -> unsigned long long
static auto map(void *) -> const void *
static auto map(float) -> float
static auto map(bool) -> bool
static auto map(T &) -> conditional_t< has_formatter< T, Char >(), T &, void >
static auto map(long double) -> long double
static auto map(unsigned) -> unsigned
static auto map(unsigned long) -> ulong_type
static auto map(nullptr_t) -> const void *
static auto map(double) -> double
static auto map(const T &) -> void
static auto map(const T &x) -> decltype(map(formatter< T >::format_as(x)))
static auto map(short) -> int
static auto map(int) -> int
static auto map(const T &x) -> decltype(map(format_as(x)))
static auto map(int128_opt) -> int128_opt
static auto map(const Char *) -> const Char *
static auto map(volatile void *) -> const void *
static auto map(uint128_opt) -> uint128_opt
static auto map(bitint< N >) -> conditional_t< N<=64, long long, void >
static auto map(ubitint< N >) -> conditional_t< N<=64, unsigned long long, void >
static auto map(long) -> long_type
A compile-time format string.
Definition base.h:2663
string_view str
Definition base.h:2675
auto get() const -> string_view
Definition base.h:2717
fstring(runtime_format_string<> fmt)
Definition base.h:2713
FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const char(&s)[N])
Definition base.h:2680
FMT_ALWAYS_INLINE fstring(const S &)
Definition base.h:2707
FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const S &s)
Definition base.h:2694
Specifies if T is an extended character type. Can be specialized by users.
Definition base.h:606
constexpr monostate()
Definition base.h:325
FMT_CONSTEXPR arg_ref(int idx=0)
Definition base.h:1225
int index
Definition base.h:1228
basic_string_view< Char > name
Definition base.h:1229
FMT_CONSTEXPR arg_ref(basic_string_view< Char > n)
Definition base.h:1226
#define S(label, offset, message)
Definition Errors.h:113
typename std::enable_if< B, T >::type enable_if_t
Definition base.h:297
#define FMT_ASSERT(condition, message)
Definition base.h:381
#define FMT_END_EXPORT
Definition base.h:250
std::integral_constant< bool, B > bool_constant
Definition base.h:300
FMT_NODISCARD FMT_INLINE auto formatted_size(format_string< T... > fmt, T &&... args) -> size_t
Returns the number of chars in the output of format(fmt, args...).
Definition base.h:2867
#define FMT_BUILTIN_TYPES
Definition base.h:279
#define FMT_PRAGMA_CLANG(x)
Definition base.h:230
#define FMT_CONSTEVAL
Definition base.h:140
#define FMT_TYPE_CONSTANT(Type, constant)
Definition base.h:964
basic_string_view< char > string_view
Definition base.h:603
#define FMT_UNICODE
Definition base.h:445
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Returns a named argument to be used in a formatting function.
Definition base.h:2775
constexpr auto min_of(T a, T b) -> T
Definition base.h:337
typename std::remove_const< T >::type remove_const_t
Definition base.h:304
FMT_API void vprintln(FILE *f, string_view fmt, format_args args)
#define FMT_FALLTHROUGH
Definition base.h:172
auto vformat_to(OutputIt &&out, string_view fmt, format_args args) -> remove_cvref_t< OutputIt >
Formats a string and writes the output to out.
Definition base.h:2783
#define FMT_NODISCARD
Definition base.h:187
typename std::remove_reference< T >::type remove_reference_t
Definition base.h:302
#define FMT_WIN32
Definition base.h:256
FMT_API void vprint(string_view fmt, format_args args)
Definition format-inl.h:1750
auto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args) -> format_to_n_result< OutputIt >
Definition base.h:2817
FMT_INLINE auto format_to(OutputIt &&out, format_string< T... > fmt, T &&... args) -> remove_cvref_t< OutputIt >
Formats args according to specifications in fmt, writes the result to the output iterator out and ret...
Definition base.h:2803
typename fstring< T... >::t format_string
Definition base.h:2720
#define FMT_TRY
Definition base.h:160
#define FMT_VISIBILITY(value)
Definition base.h:215
#define FMT_GCC_VERSION
Definition base.h:35
typename std::make_unsigned< T >::type make_unsigned_t
Definition base.h:308
#define FMT_PRAGMA_GCC(x)
Definition base.h:225
#define FMT_OPTIMIZE_SIZE
Definition base.h:273
FMT_INLINE void print(format_string< T... > fmt, T &&... args)
Formats args according to specifications in fmt and writes the output to stdout.
Definition base.h:2888
basic_appender< char > appender
Definition base.h:619
typename std::remove_cv< remove_reference_t< T > >::type remove_cvref_t
Definition base.h:306
constexpr auto max_of(T a, T b) -> T
Definition base.h:340
#define FMT_CONSTEXPR
Definition base.h:113
align
Definition base.h:684
#define FMT_ALWAYS_INLINE
Definition base.h:203
FMT_INLINE void println(FILE *f, format_string< T... > fmt, T &&... args)
Formats args according to specifications in fmt and writes the output to the file f followed by a new...
Definition base.h:2916
arg_id_kind
Definition base.h:686
FMT_NORETURN FMT_API void report_error(const char *message)
Reports a format error at compile time or, via a format_error exception, at runtime.
Definition format-inl.h:135
#define FMT_BEGIN_NAMESPACE
Definition base.h:239
sign
Definition base.h:685
auto runtime(string_view s) -> runtime_format_string<>
Creates a runtime format string.
Definition base.h:2660
#define FMT_BUILTIN
Definition base.h:2075
conditional_t< std::is_same< OutputIt, appender >::value, context, generic_context< OutputIt, Char > > basic_format_context
Definition base.h:632
#define FMT_API
Definition base.h:269
#define FMT_USE_CONSTEVAL
Definition base.h:118
#define FMT_APPLY_VARIADIC(expr)
Definition base.h:282
#define FMT_ENABLE_IF(...)
Definition base.h:334
#define FMT_BEGIN_EXPORT
Definition base.h:249
FMT_INLINE auto format_to_n(OutputIt out, size_t n, format_string< T... > fmt, T &&... args) -> format_to_n_result< OutputIt >
Formats args according to specifications in fmt, writes up to n characters of the result to the outpu...
Definition base.h:2833
void void_t
Definition base.h:321
#define FMT_CATCH(x)
Definition base.h:161
#define FMT_INLINE
Definition base.h:209
typename std::decay< T >::type decay_t
Definition base.h:311
std::is_constructible< formatter< T, Char > > FMT_DEPRECATED
Definition base.h:2732
#define FMT_NORETURN
Definition base.h:179
#define FMT_MSC_WARNING(...)
Definition base.h:235
typename std::conditional< B, T, F >::type conditional_t
Definition base.h:299
#define FMT_CONSTEXPR20
Definition base.h:141
typename std::underlying_type< T >::type underlying_t
Definition base.h:310
presentation_type
Definition base.h:661
#define FMT_END_NAMESPACE
Definition base.h:242
FMT_API void vprint_buffered(FILE *f, string_view fmt, format_args args)
conditional_t< std::is_same< Char, char >::value, context, generic_context< basic_appender< Char >, Char > > buffered_context
Definition base.h:638
decltype(nullptr) nullptr_t
Definition base.h:312
bool_constant<!std::is_same< detail::mapped_t< conditional_t< std::is_void< T >::value, int *, T >, Char >, void >::value > is_formattable
Definition base.h:2723
constexpr FMT_ALWAYS_INLINE auto make_format_args(T &... args) -> detail::format_arg_store< Context, NUM_ARGS, NUM_NAMED_ARGS, DESC >
Constructs an object that stores references to arguments and can be implicitly converted to format_ar...
Definition base.h:2753