11#if defined(FMT_IMPORT_STD) && !defined(FMT_MODULE)
20# include <type_traits>
24#define FMT_VERSION 120000
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 >= 702 && 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#ifdef FMT_NO_UNIQUE_ADDRESS
166#elif FMT_CPLUSPLUS < 202002L
168#elif FMT_HAS_CPP_ATTRIBUTE(no_unique_address)
169# define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]]
171#elif FMT_MSC_VERSION >= 1929 && !FMT_CLANG_VERSION
172# define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
174#ifndef FMT_NO_UNIQUE_ADDRESS
175# define FMT_NO_UNIQUE_ADDRESS
178#if FMT_HAS_CPP17_ATTRIBUTE(fallthrough)
179# define FMT_FALLTHROUGH [[fallthrough]]
180#elif defined(__clang__)
181# define FMT_FALLTHROUGH [[clang::fallthrough]]
182#elif FMT_GCC_VERSION >= 700 && \
183 (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 520)
184# define FMT_FALLTHROUGH [[gnu::fallthrough]]
186# define FMT_FALLTHROUGH
190#if FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && !defined(__NVCC__)
191# define FMT_NORETURN [[noreturn]]
198#elif FMT_HAS_CPP17_ATTRIBUTE(nodiscard)
199# define FMT_NODISCARD [[nodiscard]]
201# define FMT_NODISCARD
204#if FMT_GCC_VERSION || FMT_CLANG_VERSION
205# define FMT_VISIBILITY(value) __attribute__((visibility(value)))
207# define FMT_VISIBILITY(value)
211#define FMT_PRAGMA_IMPL(x) _Pragma(#x)
212#if FMT_GCC_VERSION >= 504 && !defined(__NVCOMPILER)
215# define FMT_PRAGMA_GCC(x) FMT_PRAGMA_IMPL(GCC x)
217# define FMT_PRAGMA_GCC(x)
220# define FMT_PRAGMA_CLANG(x) FMT_PRAGMA_IMPL(clang x)
222# define FMT_PRAGMA_CLANG(x)
225# define FMT_MSC_WARNING(...) __pragma(warning(__VA_ARGS__))
227# define FMT_MSC_WARNING(...)
232#if !defined(__OPTIMIZE__) && !defined(__CUDACC__) && !defined(FMT_MODULE)
234# define FMT_GCC_OPTIMIZED
238#ifdef FMT_ALWAYS_INLINE
240#elif FMT_GCC_VERSION || FMT_CLANG_VERSION
241# define FMT_ALWAYS_INLINE inline __attribute__((always_inline))
243# define FMT_ALWAYS_INLINE inline
246#if defined(NDEBUG) || defined(FMT_GCC_OPTIMIZED)
247# define FMT_INLINE FMT_ALWAYS_INLINE
249# define FMT_INLINE inline
252#ifndef FMT_BEGIN_NAMESPACE
253# define FMT_BEGIN_NAMESPACE \
255 inline namespace v12 {
256# define FMT_END_NAMESPACE \
263# define FMT_BEGIN_EXPORT
264# define FMT_END_EXPORT
273#if !defined(FMT_HEADER_ONLY) && FMT_WIN32
274# if defined(FMT_LIB_EXPORT)
275# define FMT_API __declspec(dllexport)
276# elif defined(FMT_SHARED)
277# define FMT_API __declspec(dllimport)
279#elif defined(FMT_LIB_EXPORT) || defined(FMT_SHARED)
280# define FMT_API FMT_VISIBILITY("default")
286#ifndef FMT_OPTIMIZE_SIZE
287# define FMT_OPTIMIZE_SIZE 0
292#ifndef FMT_BUILTIN_TYPES
293# define FMT_BUILTIN_TYPES 1
296#define FMT_APPLY_VARIADIC(expr) \
297 using unused = int[]; \
298 (void)unused { 0, (expr, 0)... }
303template <
bool B,
typename T =
void>
305template <
bool B,
typename T,
typename F>
318template <
typename T>
using decay_t =
typename std::decay<T>::type;
321#if (FMT_GCC_VERSION && FMT_GCC_VERSION < 500) || FMT_MSC_VERSION
323template <
typename...>
struct void_t_impl {
326template <
typename... T>
using void_t =
typename void_t_impl<T...>::type;
328template <
typename...>
using void_t = void;
339# define FMT_ENABLE_IF(...)
341# define FMT_ENABLE_IF(...) fmt::enable_if_t<(__VA_ARGS__), int> = 0
344template <
typename T>
constexpr auto min_of(T a, T b) -> T {
345 return a < b ? a : b;
347template <
typename T>
constexpr auto max_of(T a, T b) -> T {
348 return a > b ? a : b;
352 const char* message);
364#if FMT_CPLUSPLUS >= 202002L && FMT_GLIBCXX_RELEASE >= 12 && \
365 (FMT_CLANG_VERSION >= 1400 && FMT_CLANG_VERSION < 1500)
367 return __builtin_is_constant_evaluated();
368#elif defined(__cpp_lib_is_constant_evaluated)
370 return std::is_constant_evaluated();
372 return default_value;
382 const char* message);
384#if defined(FMT_ASSERT)
388# define FMT_ASSERT(condition, message) \
389 fmt::detail::ignore_unused((condition), (message))
391# define FMT_ASSERT(condition, message) \
394 : ::fmt::assert_fail(__FILE__, __LINE__, (message)))
399#elif defined(__SIZEOF_INT128__) && !defined(__NVCC__) && \
400 !(FMT_CLANG_VERSION && FMT_MSC_VERSION)
401# define FMT_USE_INT128 1
407# define FMT_USE_INT128 0
417#ifndef FMT_USE_BITINT
418# define FMT_USE_BITINT (FMT_CLANG_VERSION >= 1500)
423template <
int N>
using bitint = _BitInt(N);
424template <
int N>
using ubitint =
unsigned _BitInt(N);
431template <
typename Int>
433 FMT_ASSERT(std::is_unsigned<Int>::value ||
value >= 0,
"negative value");
437template <
typename Char>
442template <
typename T,
typename Enable =
void>
446 typename T::value_type(), 0))>>
447 : std::is_convertible<decltype(std::declval<T>().data()),
448 const typename T::value_type*> {};
455# define FMT_UNICODE 1
459 "Unicode support requires compiling with /utf-8");
461template <
typename T>
constexpr auto narrow(T*) ->
char* {
return nullptr; }
466template <
typename Char>
469 for (; n != 0; ++s1, ++s2, --n) {
470 if (*s1 < *s2)
return -1;
471 if (*s1 > *s2)
return 1;
479template <
typename Container>
481 ->
decltype(back_inserter(std::declval<Container&>()));
484template <
typename It,
typename Enable = std::true_type>
487template <
typename It>
490 decltype(adl::invoke_back_inserter<typename It::container_type>()),
491 It>::value>> : std::true_type {};
494template <
typename OutputIt>
496 typename OutputIt::container_type& {
497 struct accessor : OutputIt {
499 using OutputIt::container;
501 return *accessor(it).container;
528 : data_(s), size_(count) {}
537#if FMT_HAS_BUILTIN(__builtin_strlen) || FMT_GCC_VERSION || FMT_CLANG_VERSION
550 template <
typename S,
552 typename S::value_type, Char>::value)>
554 : data_(s.data()), size_(s.size()) {}
557 constexpr auto data() const noexcept -> const Char* {
return data_; }
560 constexpr auto size() const noexcept ->
size_t {
return size_; }
563 constexpr auto end() const noexcept ->
iterator {
return data_ + size_; }
565 constexpr auto operator[](
size_t pos)
const noexcept ->
const Char& {
576 return size_ >= sv.size_ &&
detail::compare(data_, sv.data_, sv.size_) == 0;
579 return size_ >= 1 && *data_ == c;
588 if (result != 0)
return result;
589 return size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1);
594 return lhs.compare(rhs) == 0;
597 return lhs.compare(rhs) != 0;
600 return lhs.compare(rhs) < 0;
603 return lhs.compare(rhs) <= 0;
606 return lhs.compare(rhs) > 0;
609 return lhs.compare(rhs) >= 0;
628template <
typename OutputIt,
typename Char>
634template <
typename Char>
647template <
typename T,
typename Char =
char,
typename Enable =
void>
707 align_mask = 0x00038,
708 width_mask = 0x000C0,
709 precision_mask = 0x00300,
711 uppercase_mask = 0x01000,
712 alternate_mask = 0x02000,
713 localized_mask = 0x04000,
714 fill_size_mask = 0x38000,
720 fill_size_shift = 15,
725 unsigned data_ = 1 << fill_size_shift;
726 static_assert(
sizeof(basic_specs::data_) * CHAR_BIT >= 18,
"");
729 char fill_data_[max_fill_size] = {
' '};
732 data_ = (data_ & ~fill_size_mask) |
733 (
static_cast<unsigned>(size) << fill_size_shift);
741 data_ = (data_ & ~type_mask) |
static_cast<unsigned>(t);
745 return static_cast<fmt::align
>((data_ & align_mask) >> align_shift);
748 data_ = (data_ & ~align_mask) | (
static_cast<unsigned>(a) << align_shift);
752 return static_cast<arg_id_kind>((data_ & width_mask) >> width_shift);
755 data_ = (data_ & ~width_mask) | (
static_cast<unsigned>(w) << width_shift);
759 return static_cast<arg_id_kind>((data_ & precision_mask) >>
763 data_ = (data_ & ~precision_mask) |
764 (
static_cast<unsigned>(
p) << precision_shift);
768 return (data_ & (width_mask | precision_mask)) != 0;
772 return static_cast<fmt::sign
>((data_ & sign_mask) >> sign_shift);
775 data_ = (data_ & ~sign_mask) | (
static_cast<unsigned>(s) << sign_shift);
778 constexpr auto upper() const ->
bool {
return (data_ & uppercase_mask) != 0; }
781 constexpr auto alt() const ->
bool {
return (data_ & alternate_mask) != 0; }
786 return (data_ & localized_mask) != 0;
791 return (data_ & fill_size_mask) >> fill_size_shift;
794 template <
typename Char, FMT_ENABLE_IF(std::is_same<Char,
char>::value)>
795 constexpr auto fill() const -> const Char* {
798 template <
typename Char, FMT_ENABLE_IF(!std::is_same<Char,
char>::value)>
799 constexpr auto fill() const -> const Char* {
803 template <
typename Char>
constexpr auto fill_unit() const -> Char {
804 using uchar =
unsigned char;
805 return static_cast<Char
>(
static_cast<uchar
>(fill_data_[0]) |
806 (
static_cast<uchar
>(fill_data_[1]) << 8) |
807 (
static_cast<uchar
>(fill_data_[2]) << 16));
815 template <
typename Char>
817 auto size = s.
size();
821 fill_data_[0] =
static_cast<char>(uchar);
822 fill_data_[1] =
static_cast<char>(uchar >> 8);
823 fill_data_[2] =
static_cast<char>(uchar >> 16);
826 FMT_ASSERT(size <= max_fill_size,
"invalid fill");
827 for (
size_t i = 0; i < size; ++i)
828 fill_data_[i & 3] =
static_cast<char>(s[i]);
833 for (
size_t i = 0; i < max_fill_size; ++i)
834 fill_data_[i] = specs.fill_data_[i];
882 if (next_arg_id_ < 0) {
883 report_error(
"cannot switch from manual to automatic argument indexing");
886 int id = next_arg_id_++;
894 if (next_arg_id_ > 0) {
895 report_error(
"cannot switch from automatic to manual argument indexing");
907#ifndef FMT_USE_LOCALE
908# define FMT_USE_LOCALE (FMT_OPTIMIZE_SIZE <= 1)
920 template <
typename Locale, FMT_ENABLE_IF(sizeof(Locale::collate) != 0)>
923 inline explicit operator bool()
const noexcept {
return locale_ !=
nullptr; }
927 template <
typename Locale>
auto get()
const -> Locale;
947template <
typename Char, FMT_ENABLE_IF(is_code_unit<Char>::value)>
951template <
typename T, FMT_ENABLE_IF(is_std_
string_like<T>::value)>
956template <
typename Char>
962template <
typename T,
typename Enable =
void>
999template <
typename T,
typename Char>
1002#define FMT_TYPE_CONSTANT(Type, constant) \
1003 template <typename Char> \
1004 struct type_constant<Type, Char> \
1005 : std::integral_constant<type, type::constant> {}
1029constexpr auto set(
type rhs) ->
int {
return 1 <<
static_cast<int>(rhs); }
1031 return ((
set >>
static_cast<int>(t)) & 1) != 0;
1051template <
typename T,
typename Enable = std::true_type>
1053template <
typename T>
1056template <
typename Char,
typename T>
struct named_arg;
1060template <
typename Char,
typename T>
1071template <
bool B = false>
constexpr auto count() ->
int {
return B ? 1 : 0; }
1072template <
bool B1,
bool B2,
bool... Tail>
constexpr auto count() ->
int {
1073 return (B1 ? 1 : 0) +
count<B2, Tail...>();
1077 return count<is_named_arg<T>::value...>();
1080 return count<is_static_named_arg<T>::value...>();
1089template <
typename Char>
1091 int named_arg_index,
1093 for (
int i = 0; i < named_arg_index; ++i) {
1094 if (named_args[i].name == arg_name)
report_error(
"duplicate named arg");
1098template <
typename Char,
typename T, FMT_ENABLE_IF(!is_named_arg<T>::value)>
1102template <
typename Char,
typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>
1103void init_named_arg(named_arg_info<Char>* named_args,
int& arg_index,
1104 int& named_arg_index,
const T&
arg) {
1106 named_args[named_arg_index++] = {
arg.name, arg_index++};
1109template <
typename T,
typename Char,
1115template <
typename T,
typename Char,
1118 int& arg_index,
int& named_arg_index) {
1120 named_args[named_arg_index++] = {T::name, arg_index++};
1129template <
typename T>
1132template <
typename T>
1136template <
typename T,
typename Enable = std::true_type>
1139template <
typename T,
typename Enable = std::true_type>
1143template <
typename T>
1146 : std::true_type {};
1147template <
typename T>
1150 : std::true_type {};
1152template <
typename T,
typename U = remove_const_t<T>>
1154 bool_constant<(std::is_class<T>::value || std::is_enum<T>::value ||
1155 std::is_union<T>::value || std::is_array<T>::value) &&
1159template <
typename Char,
typename T,
typename U = remove_const_t<T>>
1172 static auto map(
signed char) -> int;
1173 static auto map(
unsigned char) -> unsigned;
1174 static auto map(
short) -> int;
1175 static auto map(
unsigned short) -> unsigned;
1177 static auto map(
unsigned) -> unsigned;
1180 static auto map(
long long) ->
long long;
1181 static auto map(
unsigned long long) ->
unsigned long long;
1184 static auto map(
bool) -> bool;
1192 template <
typename T, FMT_ENABLE_IF(is_code_unit<T>::value)>
1194 std::is_same<T, char>::value || std::is_same<T, Char>::value, Char,
void>;
1196 static auto map(
float) -> float;
1197 static auto map(
double) -> double;
1198 static auto map(
long double) ->
long double;
1200 static auto map(Char*) ->
const Char*;
1201 static auto map(
const Char*) ->
const Char*;
1202 template <
typename T,
typename C =
char_t<T>,
1203 FMT_ENABLE_IF(!std::is_po
inter<T>::value)>
1207 static auto map(
void*) ->
const void*;
1208 static auto map(
const void*) ->
const void*;
1209 static auto map(
volatile void*) ->
const void*;
1210 static auto map(
const volatile void*) ->
const void*;
1212 template <
typename T, FMT_ENABLE_IF(std::is_po
inter<T>::value ||
1213 std::is_member_po
inter<T>::value)>
1214 static auto map(
const T&) -> void;
1216 template <
typename T, FMT_ENABLE_IF(use_format_as<T>::value)>
1218 template <
typename T, FMT_ENABLE_IF(use_format_as_member<T>::value)>
1221 template <
typename T, FMT_ENABLE_IF(use_formatter<T>::value)>
1224 template <
typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>
1229template <
typename T,
typename Char>
1233template <
typename T,
typename Char =
char>
1236template <
typename T,
typename Context,
1243template <
typename Char>
1256 constexpr auto num_args() const ->
int {
return num_args_; }
1261 if (
id >= num_args_)
report_error(
"argument not found");
1267 if (
id >= num_args_)
report_error(
"argument not found");
1296template <
typename Char, FMT_ENABLE_IF(std::is_
integral<Char>::value)>
1298 return c <= 0xff ? static_cast<char>(c) :
'\0';
1302template <
typename Char>
1305 auto c =
static_cast<unsigned char>(*begin);
1306 return static_cast<int>((0x3a55000000000000ull >> (2 * (c >> 3))) & 3) + 1;
1311template <
typename Char>
1313 int error_value)
noexcept ->
int {
1314 FMT_ASSERT(begin != end &&
'0' <= *begin && *begin <=
'9',
"");
1315 unsigned value = 0, prev = 0;
1321 }
while (
p != end &&
'0' <= *
p && *
p <=
'9');
1322 auto num_digits =
p - begin;
1324 int digits10 =
static_cast<int>(
sizeof(int) * CHAR_BIT * 3 / 10);
1327 unsigned max = INT_MAX;
1328 return num_digits ==
digits10 + 1 &&
1329 prev * 10ull + unsigned(
p[-1] -
'0') <= max
1330 ?
static_cast<int>(
value)
1344 return (
'a' <= c && c <=
'z') || (
'A' <= c && c <=
'Z') || c ==
'_';
1347template <
typename Char,
typename Handler>
1349 Handler&& handler) ->
const Char* {
1351 if (c >=
'0' && c <=
'9') {
1357 if (begin == end || (*begin !=
'}' && *begin !=
':'))
1360 handler.on_index(
index);
1370 }
while (it != end && (
is_name_start(*it) || (
'0' <= *it && *it <=
'9')));
1371 handler.on_name({begin,
to_unsigned(it - begin)});
1399template <
typename Char>
1406 if (
'0' <= *begin && *begin <=
'9') {
1411 if (*begin ==
'{') {
1415 if (c ==
'}' || c ==
':') {
1416 int id = ctx.next_arg_id();
1419 ctx.check_dynamic_spec(
id);
1425 if (begin != end && *begin ==
'}')
return {++begin, kind};
1429 return {begin, kind};
1432template <
typename Char>
1437 specs.set_dynamic_width(result.kind);
1441template <
typename Char>
1453 specs.set_dynamic_precision(result.kind);
1460template <
typename Char>
1466 if (end - begin > 1) {
1470 if (begin == end)
return begin;
1477 if (current_state >= s || !valid)
1495 } parse_presentation_type{begin, specs, arg_type};
1522 report_error(
"format specifier requires numeric argument");
1526 specs.set_fill(
'0');
1531 case '1':
case '2':
case '3':
case '4':
case '5':
1532 case '6':
case '7':
case '8':
case '9':
case '{':
1535 begin =
parse_width(begin, end, specs, specs.width_ref, ctx);
1544 specs.set_localized();
1547 case 'd':
return parse_presentation_type(pres::dec, integral_set);
1549 case 'x':
return parse_presentation_type(pres::hex, integral_set);
1550 case 'o':
return parse_presentation_type(pres::oct, integral_set);
1552 case 'b':
return parse_presentation_type(pres::bin, integral_set);
1554 case 'e':
return parse_presentation_type(pres::exp,
float_set);
1556 case 'f':
return parse_presentation_type(pres::fixed,
float_set);
1558 case 'g':
return parse_presentation_type(pres::general,
float_set);
1560 case 'a':
return parse_presentation_type(pres::hexfloat,
float_set);
1563 return parse_presentation_type(pres::chr, integral_set);
1565 return parse_presentation_type(pres::string,
1570 return parse_presentation_type(pres::debug,
1572 case '}':
return begin;
1574 if (*begin ==
'}')
return begin;
1577 if (end - fill_end <= 0) {
1581 if (*begin ==
'{') {
1589 specs.set_align(alignment);
1590 begin = fill_end + 1;
1593 if (begin == end)
return begin;
1598template <
typename Char,
typename Handler>
1605 handler.on_error(
"invalid format string");
1611 handler.on_replacement_field(handler.on_arg_id(), begin);
1613 case '{': handler.on_text(begin, begin + 1);
return begin + 1;
1614 case ':': arg_id = handler.on_arg_id();
break;
1620 FMT_CONSTEXPR void on_index(
int id) { arg_id = handler.on_arg_id(
id); }
1622 arg_id = handler.on_arg_id(
id);
1624 } adapter = {handler, 0};
1626 arg_id = adapter.arg_id;
1627 Char c = begin != end ? *begin : Char();
1629 handler.on_replacement_field(arg_id, begin);
1633 handler.on_error(
"missing '}' in format string");
1639 begin = handler.on_format_specs(arg_id, begin + 1, end);
1640 if (begin == end || *begin !=
'}')
1641 return handler.on_error(
"unknown format specifier"), end;
1645template <
typename Char,
typename Handler>
1647 Handler&& handler) {
1648 auto begin = fmt.
data(), end = begin + fmt.
size();
1653 handler.on_text(begin,
p - 1);
1655 }
else if (c ==
'}') {
1656 if (
p == end || *
p !=
'}')
1657 return handler.on_error(
"unmatched '}' in format string");
1658 handler.on_text(begin,
p);
1662 handler.on_text(begin, end);
1667 auto type = specs.type();
1682template <
typename T,
typename Char>
1686 constexpr bool formattable =
1687 std::is_constructible<formatter<mapped_type, Char>>::value;
1688 if (!formattable)
return ctx.begin();
1695template <
typename Char,
int NUM_ARGS,
int NUM_NAMED_ARGS,
bool DYNAMIC_NAMES>
1706 template <
typename... T>
1711 context_(fmt, NUM_ARGS, types_),
1713 int arg_index = 0, named_arg_index = 0;
1727 for (
int i = 0; i < NUM_NAMED_ARGS; ++i) {
1728 if (named_args_[i].name ==
id)
return named_args_[i].
id;
1730 if (!DYNAMIC_NAMES)
on_error(
"argument not found");
1741 if (
id >= 0 &&
id < NUM_ARGS)
return parse_funcs_[id](context_);
1746 for (
int bracket_count = 0;
1747 begin != end && (bracket_count > 0 || *begin !=
'}'); ++begin) {
1750 else if (*begin ==
'}')
1776 : size_(sz), capacity_(sz), grow_(grow) {}
1778 constexpr buffer(grow_fun grow, T*
p =
nullptr,
size_t sz = 0,
1779 size_t cap = 0) noexcept
1780 : ptr_(
p), size_(sz), capacity_(cap), grow_(grow) {}
1788 capacity_ = buf_capacity;
1798 auto begin() noexcept -> T* {
return ptr_; }
1799 auto end() noexcept -> T* {
return ptr_ + size_; }
1801 auto begin() const noexcept -> const T* {
return ptr_; }
1802 auto end() const noexcept -> const T* {
return ptr_ + size_; }
1805 constexpr auto size() const noexcept ->
size_t {
return size_; }
1808 constexpr auto capacity() const noexcept ->
size_t {
return capacity_; }
1829 if (new_capacity > capacity_) grow_(*
this, new_capacity);
1834 ptr_[size_++] =
value;
1838 template <
typename U>
1841#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1940
1846 while (begin != end) {
1849 auto free_cap = capacity_ - size_;
1852 T* out = ptr_ + size_;
1853 for (
size_t i = 0; i <
count; ++i) out[i] = begin[i];
1862 template <
typename Idx>
1870 constexpr auto count() const ->
size_t {
return 0; }
1871 constexpr auto limit(
size_t size)
const ->
size_t {
return size; }
1881 constexpr auto count() const ->
size_t {
return count_; }
1883 size_t n = limit_ > count_ ? limit_ - count_ : 0;
1890template <
typename OutputIt,
typename T,
typename Traits = buffer_traits>
1894 enum { buffer_size = 256 };
1895 T data_[buffer_size];
1902 auto size = this->
size();
1904 const T* begin = data_;
1905 const T* end = begin + this->
limit(size);
1906 while (begin != end) *out_++ = *begin++;
1911 : Traits(n),
buffer<T>(grow, data_, 0, buffer_size), out_(out) {}
1926 auto count() const ->
size_t {
return Traits::count() + this->
size(); }
1929template <
typename T>
1934 enum { buffer_size = 256 };
1935 T data_[buffer_size];
1943 size_t n = this->limit(this->size());
1944 if (this->data() == out_) {
1946 this->
set(data_, buffer_size);
1958 if (this->data() != out_) {
1959 this->
set(data_, buffer_size);
1977 :
buffer<T>([](
buffer<T>&, size_t) {}, out, 0, ~size_t()) {}
1979 auto out() -> T* {
return &*this->end(); }
1982template <
typename Container>
1985 using value_type =
typename Container::value_type;
1990 self.set(&self.container[0],
capacity);
2001template <
typename OutputIt>
2006 typename OutputIt::container_type::value_type>>
2016 auto out() -> OutputIt {
return OutputIt(this->container); }
2022 enum { buffer_size = 256 };
2023 T data_[buffer_size];
2027 if (buf.
size() != buffer_size)
return;
2035 constexpr auto count() const noexcept ->
size_t {
2036 return count_ + this->
size();
2040template <
typename T>
2043template <
typename OutputIt,
typename InputIt,
typename =
void>
2045template <
typename OutputIt,
typename InputIt>
2049 .append(std::declval<InputIt>(),
2050 std::declval<InputIt>()))>> : std::true_type {};
2052template <
typename OutputIt,
typename InputIt,
typename =
void>
2055template <
typename OutputIt,
typename InputIt>
2059 .insert(get_container(std::declval<OutputIt>()).end(),
2060 std::declval<InputIt>(),
2061 std::declval<InputIt>()))>> : std::true_type {};
2064template <
typename T,
typename InputIt,
typename OutputIt,
2067 OutputIt, InputIt>::value)>
2074template <
typename T,
typename InputIt,
typename OutputIt,
2076 !has_back_insert_iterator_container_append<
2077 OutputIt, InputIt>::value &&
2078 has_back_insert_iterator_container_insert_at_end<
2079 OutputIt, InputIt>::value)>
2083 c.insert(c.end(), begin, end);
2087template <
typename T,
typename InputIt,
typename OutputIt,
2089 (has_back_insert_iterator_container_append<
2090 OutputIt, InputIt>::value ||
2091 has_back_insert_iterator_container_insert_at_end<
2092 OutputIt, InputIt>::value)))>
2094 while (begin != end) *out++ =
static_cast<T
>(*begin++);
2098template <
typename T,
typename V,
typename OutputIt>
2100 return copy<T>(s.begin(), s.end(), out);
2103template <
typename It,
typename Enable = std::true_type>
2105template <
typename It>
2109 std::is_base_of<buffer<typename It::container_type::value_type>,
2110 typename It::container_type>::value>>
2111 : std::true_type {};
2114template <
typename T,
typename OutputIt,
2119template <
typename T,
typename OutputIt,
2125template <
typename Buf,
typename OutputIt>
2129template <
typename T,
typename OutputIt>
2156#if !FMT_BUILTIN_TYPES
2157# define FMT_BUILTIN , monostate
2163template <
typename Context>
class value {
2205 static_assert(N <= 64,
"unsupported _BitInt");
2209 static_assert(N <= 64,
"unsupported _BitInt");
2212 template <
typename T, FMT_ENABLE_IF(is_code_unit<T>::value)>
2215 std::is_same<T, char>::value || std::is_same<T, char_type>::value,
2216 "mixing character types is disallowed");
2231 template <
typename T,
typename C =
char_t<T>,
2232 FMT_ENABLE_IF(!std::is_po
inter<T>::value)>
2234 static_assert(std::is_same<C, char_type>::value,
2235 "mixing character types is disallowed");
2237 string.data = sv.data();
2238 string.size = sv.size();
2243 :
pointer(const_cast<const void*>(x)) {}
2245 :
pointer(const_cast<const void*>(x)) {}
2248 template <
typename T, FMT_ENABLE_IF(std::is_po
inter<T>::value ||
2249 std::is_member_po
inter<T>::value)>
2254 static_assert(
sizeof(T) == 0,
2255 "formatting of non-void pointers is disallowed");
2258 template <
typename T, FMT_ENABLE_IF(use_format_as<T>::value)>
2260 template <
typename T, FMT_ENABLE_IF(use_format_as_member<T>::value)>
2263 template <
typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>
2266 template <
typename T,
2274 template <typename T, FMT_ENABLE_IF(has_formatter<T, char_type>())>
2280 const_cast<char*
>(&
reinterpret_cast<const volatile char&
>(x));
2283#if defined(__cpp_if_constexpr)
2285 custom.value =
const_cast<value_type*
>(&x);
2288 custom.format = format_custom<value_type>;
2291 template <typename T, FMT_ENABLE_IF(!has_formatter<T, char_type>())>
2295 type_is_unformattable_for<T, char_type> _;
2299 template <
typename T>
2304 using qualified_type =
2308 ctx.advance_to(cf.format(*
static_cast<qualified_type*
>(
arg), ctx));
2318template <
typename It,
typename T,
typename Enable =
void>
2323template <
typename It,
typename T>
2326 enable_if_t<
std::is_assignable<decltype(*std::declval<decay_t<It>&>()++),
2327 T>::value>> : std::true_type {};
2333template <
typename Context,
typename First,
typename... T>
2339template <
typename Context,
typename... T,
size_t NUM_ARGS =
sizeof...(T)>
2345template <
typename Context,
int NUM_ARGS>
2349template <
typename Context,
int NUM_ARGS,
int NUM_NAMED_ARGS,
2350 unsigned long long DESC>
2357 template <
typename... T>
2360 int arg_index = 0, named_arg_index = 0;
2366 args[0] = {named_args, NUM_NAMED_ARGS};
2367 for (
size_t i = 1; i <
sizeof(args) /
sizeof(*args); ++i)
2368 args[i] = rhs.args[i];
2369 for (
size_t i = 0; i < NUM_NAMED_ARGS; ++i)
2370 named_args[i] = rhs.named_args[i];
2382template <
typename Context,
int NUM_ARGS,
int NUM_NAMED_ARGS,
2383 unsigned long long DESC>
2402 if (ctx.begin() == ctx.end() || *ctx.begin() ==
'}')
return ctx.begin();
2408 template <
type U = TYPE,
2409 FMT_ENABLE_IF(U == type::string_type || U == type::cstring_type ||
2410 U == type::char_type)>
2416 template <
typename FormatContext>
2418 ->
decltype(ctx.out());
2421template <
typename T,
typename Enable =
void>
2423 :
bool_constant<mapped_type_constant<T>::value == type::custom_type> {};
2424template <
typename T>
2426 : std::false_type {};
2431template <
typename T1,
typename T2,
typename... Tail>
2448template <
typename Char>
2454 if (arg_id >= ctx->num_args())
report_error(
"argument not found");
2458template <
typename Char>
2462 static_cast<compile_parse_context<Char>*
>(
this)->check_dynamic_spec(arg_id);
2496 using char_type =
typename Context::char_type;
2513 : value_(args, size) {}
2514 template <
typename T>
2516 : value_(val), type_(
detail::stored_type_constant<T, Context>::value) {}
2518 constexpr explicit operator bool() const noexcept {
2528 template <
typename Visitor>
2557 value_.
custom.format(value_.
custom.value, parse_ctx, ctx);
2576 unsigned long long desc_;
2587 constexpr auto is_packed() const ->
bool {
2590 constexpr auto has_named_args() const ->
bool {
2597 return static_cast<detail::type>((desc_ >> shift) & mask);
2600 template <
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC>
2610 template <
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC,
2614 : desc_(DESC | (NUM_NAMED_ARGS != 0 ? +
detail::has_named_args_bit : 0)),
2617 template <
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC,
2620 : desc_(DESC | (NUM_NAMED_ARGS != 0 ? +
detail::has_named_args_bit : 0)),
2625 bool has_named =
false)
2626 : desc_(
detail::is_unpacked_bit |
detail::to_unsigned(count) |
2627 (has_named ? +
detail::has_named_args_bit : 0)),
2638 arg.type_ = type(
id);
2643 template <
typename Char>
2649 template <
typename Char>
2651 if (!has_named_args())
return -1;
2652 const auto& named_args =
2653 (is_packed() ?
values_[-1] :
args_[-1].value_).named_args;
2654 for (
size_t i = 0; i < named_args.size; ++i) {
2655 if (named_args.data[i].name == name)
return named_args.data[i].id;
2662 return static_cast<int>(is_packed() ? max_packed
2663 : desc_ &
~detail::is_unpacked_bit);
2683 : out_(out), args_(
args), loc_(loc) {}
2690 return args_.
get(name);
2693 return args_.
get_id(name);
2724 static constexpr int num_static_named_args =
2728 char,
static_cast<int>(
sizeof...(T)), num_static_named_args,
2742 std::is_reference<T>::value)...>() == 0,
2743 "passing views as lvalues is disallowed");
2745#ifdef FMT_ENFORCE_COMPILE_STRING
2748 "FMT_ENFORCE_COMPILE_STRING requires format strings to use FMT_STRING");
2751 template <
typename S,
2752 FMT_ENABLE_IF(std::is_convertible<const S&, string_view>::value)>
2757#ifdef FMT_ENFORCE_COMPILE_STRING
2760 "FMT_ENFORCE_COMPILE_STRING requires format strings to use FMT_STRING");
2763 template <
typename S,
2764 FMT_ENABLE_IF(std::is_base_of<detail::compile_string, S>::value&&
2765 std::is_same<typename S::char_type, char>::value)>
2781template <
typename T,
typename Char =
char>
2785#ifdef __cpp_concepts
2786template <
typename T,
typename Char =
char>
2791template <
typename T,
typename Char>
2805template <
typename Context =
context,
typename... T,
2806 int NUM_ARGS =
sizeof...(T),
2816template <
typename... T>
2830template <
typename Char,
typename T>
2836template <
typename OutputIt,
2856template <
typename OutputIt,
typename... T,
2871template <
typename OutputIt,
typename... T,
2878 return {buf.out(), buf.count()};
2887template <
typename OutputIt,
typename... T,
2911 return {result.out, result.size > N};
2914template <
size_t N,
typename... T>
2918 return {result.out, result.size > N};
2922template <
typename... T>
2924 T&&... args) ->
size_t {
2943template <
typename... T>
2945 vargs<T...> va = {{args...}};
2960template <
typename... T>
2962 vargs<T...> va = {{args...}};
2966 :
vprint(f, fmt.str, va);
2971template <
typename... T>
2973 vargs<T...> va = {{args...}};
2981template <
typename... T>
2983 return fmt::println(stdout, fmt,
static_cast<T&&
>(args)...);
2991#ifdef FMT_HEADER_ONLY
constexpr auto format_as(HAL_AddressableLEDColorOrder order)
Definition AddressableLEDTypes.h:33
typename std::enable_if< B, T >::type enable_if_t
Definition base.h:304
#define FMT_ASSERT(condition, message)
Definition base.h:391
#define FMT_END_EXPORT
Definition base.h:264
std::integral_constant< bool, B > bool_constant
Definition base.h:307
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:2923
#define FMT_BUILTIN_TYPES
Definition base.h:293
#define FMT_PRAGMA_CLANG(x)
Definition base.h:222
#define FMT_CONSTEVAL
Definition base.h:140
#define FMT_TYPE_CONSTANT(Type, constant)
Definition base.h:1002
basic_string_view< char > string_view
Definition base.h:613
#define FMT_UNICODE
Definition base.h:455
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:2831
constexpr auto min_of(T a, T b) -> T
Definition base.h:344
typename std::remove_const< T >::type remove_const_t
Definition base.h:311
FMT_API void vprintln(FILE *f, string_view fmt, format_args args)
#define FMT_FALLTHROUGH
Definition base.h:186
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:2839
#define FMT_NODISCARD
Definition base.h:201
typename std::remove_reference< T >::type remove_reference_t
Definition base.h:309
#define FMT_WIN32
Definition base.h:270
FMT_API void vprint(string_view fmt, format_args args)
Definition format-inl.h:1756
auto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args) -> format_to_n_result< OutputIt >
Definition base.h:2873
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:2859
typename fstring< T... >::t format_string
Definition base.h:2779
#define FMT_TRY
Definition base.h:160
#define FMT_VISIBILITY(value)
Definition base.h:207
#define FMT_GCC_VERSION
Definition base.h:35
typename std::make_unsigned< T >::type make_unsigned_t
Definition base.h:315
#define FMT_PRAGMA_GCC(x)
Definition base.h:217
#define FMT_OPTIMIZE_SIZE
Definition base.h:287
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:2944
basic_appender< char > appender
Definition base.h:616
typename std::remove_cv< remove_reference_t< T > >::type remove_cvref_t
Definition base.h:313
constexpr auto max_of(T a, T b) -> T
Definition base.h:347
#define FMT_CONSTEXPR
Definition base.h:113
align
Definition base.h:681
#define FMT_ALWAYS_INLINE
Definition base.h:243
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:2972
arg_id_kind
Definition base.h:683
FMT_NORETURN FMT_API void assert_fail(const char *file, int line, const char *message)
Definition format-inl.h:36
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:143
#define FMT_BEGIN_NAMESPACE
Definition base.h:253
sign
Definition base.h:682
auto runtime(string_view s) -> runtime_format_string<>
Creates a runtime format string.
Definition base.h:2718
#define FMT_BUILTIN
Definition base.h:2157
conditional_t< std::is_same< OutputIt, appender >::value, context, generic_context< OutputIt, Char > > basic_format_context
Definition base.h:629
#define FMT_API
Definition base.h:283
#define FMT_USE_CONSTEVAL
Definition base.h:118
#define FMT_APPLY_VARIADIC(expr)
Definition base.h:296
#define FMT_ENABLE_IF(...)
Definition base.h:341
#define FMT_BEGIN_EXPORT
Definition base.h:263
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:2889
void void_t
Definition base.h:328
#define FMT_CATCH(x)
Definition base.h:161
#define FMT_INLINE
Definition base.h:247
typename std::decay< T >::type decay_t
Definition base.h:318
#define FMT_NO_UNIQUE_ADDRESS
Definition base.h:175
#define FMT_NORETURN
Definition base.h:193
#define FMT_MSC_WARNING(...)
Definition base.h:227
typename std::conditional< B, T, F >::type conditional_t
Definition base.h:306
#define FMT_CONSTEXPR20
Definition base.h:141
typename std::underlying_type< T >::type underlying_t
Definition base.h:317
presentation_type
Definition base.h:658
#define FMT_END_NAMESPACE
Definition base.h:256
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:635
decltype(nullptr) nullptr_t
Definition base.h:319
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:2782
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:2809
FMT_CONSTEXPR20 auto operator=(T c) -> basic_appender &
Definition base.h:2478
FMT_CONSTEXPR20 auto operator++(int) -> basic_appender
Definition base.h:2484
detail::buffer< T > * container
Definition base.h:2471
FMT_CONSTEXPR20 auto operator++() -> basic_appender &
Definition base.h:2483
FMT_CONSTEXPR20 auto operator*() -> basic_appender &
Definition base.h:2482
FMT_CONSTEXPR basic_appender(detail::buffer< T > &buf)
Definition base.h:2476
FMT_CONSTEXPR void copy_fill_from(const basic_specs &specs)
Definition base.h:831
FMT_CONSTEXPR void set_fill(char c)
Definition base.h:810
constexpr auto align() const -> align
Definition base.h:744
FMT_CONSTEXPR void set_dynamic_precision(arg_id_kind p)
Definition base.h:762
FMT_CONSTEXPR auto dynamic_precision() const -> arg_id_kind
Definition base.h:758
FMT_CONSTEXPR void set_fill(basic_string_view< Char > s)
Definition base.h:816
constexpr auto sign() const -> sign
Definition base.h:771
FMT_CONSTEXPR void set_alt()
Definition base.h:782
constexpr auto localized() const -> bool
Definition base.h:785
FMT_CONSTEXPR void set_sign(fmt::sign s)
Definition base.h:774
constexpr auto dynamic() const -> bool
Definition base.h:767
constexpr auto upper() const -> bool
Definition base.h:778
FMT_CONSTEXPR void clear_alt()
Definition base.h:783
constexpr auto type() const -> presentation_type
Definition base.h:737
constexpr auto fill() const -> const Char *
Definition base.h:795
FMT_CONSTEXPR void set_upper()
Definition base.h:779
constexpr auto alt() const -> bool
Definition base.h:781
constexpr auto dynamic_width() const -> arg_id_kind
Definition base.h:751
constexpr auto fill_unit() const -> Char
Definition base.h:803
FMT_CONSTEXPR void set_align(fmt::align a)
Definition base.h:747
FMT_CONSTEXPR void set_type(presentation_type t)
Definition base.h:740
FMT_CONSTEXPR void set_dynamic_width(arg_id_kind w)
Definition base.h:754
constexpr auto fill_size() const -> size_t
Definition base.h:790
FMT_CONSTEXPR void set_localized()
Definition base.h:788
An implementation of std::basic_string_view for pre-C++17.
Definition base.h:515
constexpr auto end() const noexcept -> iterator
Definition base.h:563
const Char * iterator
Definition base.h:522
constexpr auto size() const noexcept -> size_t
Returns the string size.
Definition base.h:560
constexpr basic_string_view(nullptr_t)=delete
FMT_CONSTEXPR basic_string_view(const S &s) noexcept
Constructs a string view from a std::basic_string or a std::basic_string_view object.
Definition base.h:553
constexpr auto data() const noexcept -> const Char *
Returns a pointer to the string data.
Definition base.h:557
friend auto operator>(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:605
FMT_CONSTEXPR auto starts_with(Char c) const noexcept -> bool
Definition base.h:578
constexpr auto begin() const noexcept -> iterator
Definition base.h:562
friend auto operator<(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:599
Char value_type
Definition base.h:521
FMT_CONSTEXPR auto starts_with(const Char *s) const -> bool
Definition base.h:581
friend auto operator<=(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:602
FMT_CONSTEXPR void remove_prefix(size_t n) noexcept
Definition base.h:569
FMT_CONSTEXPR friend auto operator==(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:592
friend auto operator!=(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:596
constexpr auto operator[](size_t pos) const noexcept -> const Char &
Definition base.h:565
constexpr basic_string_view(const Char *s, size_t count) noexcept
Constructs a string view object from a C string and a size.
Definition base.h:527
FMT_CONSTEXPR20 basic_string_view(const Char *s)
Constructs a string view object from a C string.
Definition base.h:536
FMT_CONSTEXPR auto starts_with(basic_string_view< Char > sv) const noexcept -> bool
Definition base.h:574
constexpr basic_string_view() noexcept
Definition base.h:524
friend auto operator>=(basic_string_view lhs, basic_string_view rhs) -> bool
Definition base.h:608
FMT_CONSTEXPR auto compare(basic_string_view other) const -> int
Definition base.h:585
FMT_CONSTEXPR void advance_to(iterator)
Definition base.h:2701
@ builtin_types
Definition base.h:2678
FMT_CONSTEXPR context(iterator out, format_args args, locale_ref loc={})
Constructs a context object.
Definition base.h:2682
void operator=(const context &)=delete
FMT_CONSTEXPR auto locale() const -> locale_ref
Definition base.h:2703
FMT_CONSTEXPR auto arg_id(string_view name) const -> int
Definition base.h:2692
auto args() const -> const format_args &
Definition base.h:2695
context(context &&)=default
char char_type
The character type for the output.
Definition base.h:2675
FMT_CONSTEXPR auto out() const -> iterator
Definition base.h:2698
auto arg(string_view name) const -> format_arg
Definition base.h:2689
context(const context &)=delete
FMT_CONSTEXPR auto arg(int id) const -> format_arg
Definition base.h:2688
A contiguous memory buffer with an optional growing ability.
Definition base.h:1763
FMT_CONSTEXPR buffer(grow_fun grow, size_t sz) noexcept
Definition base.h:1775
auto end() const noexcept -> const T *
Definition base.h:1802
FMT_CONSTEXPR20 void append(const U *begin, const U *end)
Appends data to the end of the buffer.
Definition base.h:1845
auto begin() const noexcept -> const T *
Definition base.h:1801
FMT_CONSTEXPR void push_back(const T &value)
Definition base.h:1832
T value_type
Definition base.h:1792
FMT_CONSTEXPR void set(T *buf_data, size_t buf_capacity) noexcept
Sets the buffer data and capacity.
Definition base.h:1786
FMT_CONSTEXPR auto operator[](Idx index) const -> const T &
Definition base.h:1863
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition base.h:1805
FMT_CONSTEXPR void try_reserve(size_t new_capacity)
Definition base.h:1828
FMT_CONSTEXPR auto data() const noexcept -> const T *
Definition base.h:1812
constexpr buffer(grow_fun grow, T *p=nullptr, size_t sz=0, size_t cap=0) noexcept
Definition base.h:1778
buffer(const buffer &)=delete
auto end() noexcept -> T *
Definition base.h:1799
FMT_CONSTEXPR void try_resize(size_t count)
Definition base.h:1819
constexpr auto capacity() const noexcept -> size_t
Returns the capacity of this buffer.
Definition base.h:1808
FMT_CONSTEXPR20 ~buffer()=default
auto begin() noexcept -> T *
Definition base.h:1798
const T & const_reference
Definition base.h:1793
FMT_CONSTEXPR auto operator[](Idx index) -> T &
Definition base.h:1859
void operator=(const buffer &)=delete
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data (not null-terminated).
Definition base.h:1811
buffer(buffer &&)=default
FMT_CONSTEXPR void clear()
Clears this buffer.
Definition base.h:1815
constexpr auto num_args() const -> int
Definition base.h:1256
FMT_CONSTEXPR compile_parse_context(basic_string_view< Char > fmt, int num_args, const type *types, int next_arg_id=0)
Definition base.h:1251
FMT_CONSTEXPR auto next_arg_id() -> int
Definition base.h:1259
FMT_CONSTEXPR void check_arg_id(int id)
Definition base.h:1265
constexpr auto arg_type(int id) const -> type
Definition base.h:1257
FMT_CONSTEXPR void check_dynamic_spec(int arg_id)
Definition base.h:1271
Container & container
Definition base.h:1994
container_buffer(Container &c)
Definition base.h:1996
FMT_CONSTEXPR counting_buffer()
Definition base.h:2033
constexpr auto count() const noexcept -> size_t
Definition base.h:2035
constexpr auto count() const -> size_t
Definition base.h:1881
constexpr fixed_buffer_traits(size_t limit)
Definition base.h:1880
FMT_CONSTEXPR auto limit(size_t size) -> size_t
Definition base.h:1882
iterator_buffer(OutputIt out, size_t=0)
Definition base.h:2013
iterator_buffer(typename OutputIt::container_type &c)
Definition base.h:2012
auto out() -> OutputIt
Definition base.h:2016
~iterator_buffer()
Definition base.h:1963
auto count() const -> size_t
Definition base.h:1969
iterator_buffer(T *out, size_t n=buffer_size)
Definition base.h:1952
auto out() -> T *
Definition base.h:1965
iterator_buffer(iterator_buffer &&other) noexcept
Definition base.h:1954
auto out() -> T *
Definition base.h:1979
iterator_buffer(T *out, size_t=0)
Definition base.h:1976
iterator_buffer(iterator_buffer &&other) noexcept
Definition base.h:1912
iterator_buffer(OutputIt out, size_t n=buffer_size)
Definition base.h:1910
auto count() const -> size_t
Definition base.h:1926
~iterator_buffer()
Definition base.h:1916
auto out() -> OutputIt
Definition base.h:1922
int int_value
Definition base.h:2169
FMT_INLINE value(long double x FMT_BUILTIN)
Definition base.h:2221
value(const T &)
Definition base.h:2250
uint128_opt uint128_value
Definition base.h:2174
bool bool_value
Definition base.h:2175
FMT_INLINE value(uint128_opt x FMT_BUILTIN)
Definition base.h:2200
value(const T &named_arg)
Definition base.h:2264
constexpr FMT_INLINE value(bitint< N > x FMT_BUILTIN)
Definition base.h:2204
constexpr FMT_INLINE value(T x FMT_BUILTIN)
Definition base.h:2213
unsigned long long ulong_long_value
Definition base.h:2172
double double_value
Definition base.h:2178
FMT_CONSTEXPR FMT_INLINE value(unsigned long x FMT_BUILTIN)
Definition base.h:2194
constexpr FMT_INLINE value(int x)
Definition base.h:2191
long double long_double_value
Definition base.h:2179
FMT_CONSTEXPR FMT_INLINE value(const char_type *x FMT_BUILTIN)
Definition base.h:2227
constexpr FMT_INLINE value(double x FMT_BUILTIN)
Definition base.h:2220
FMT_INLINE value(const volatile void *x FMT_BUILTIN)
Definition base.h:2244
FMT_INLINE value(const void *x FMT_BUILTIN)
Definition base.h:2241
constexpr FMT_INLINE value(unsigned long long x FMT_BUILTIN)
Definition base.h:2197
FMT_CONSTEXPR20 FMT_INLINE value(T &x)
Definition base.h:2268
FMT_CONSTEXPR FMT_INLINE value(char_type *x FMT_BUILTIN)
Definition base.h:2223
FMT_CONSTEXPR value(const T &x FMT_BUILTIN)
Definition base.h:2233
float float_value
Definition base.h:2177
constexpr FMT_INLINE value()
Definition base.h:2186
constexpr FMT_INLINE value(float x FMT_BUILTIN)
Definition base.h:2219
int128_opt int128_value
Definition base.h:2173
FMT_CONSTEXPR FMT_INLINE value(long x FMT_BUILTIN)
Definition base.h:2193
constexpr FMT_INLINE value(unsigned char x FMT_BUILTIN)
Definition base.h:2188
FMT_INLINE value(volatile void *x FMT_BUILTIN)
Definition base.h:2242
custom_value< Context > custom
Definition base.h:2182
FMT_ALWAYS_INLINE value(const named_arg_info< char_type > *args, size_t size)
Definition base.h:2270
constexpr FMT_INLINE value(ubitint< N > x FMT_BUILTIN)
Definition base.h:2208
named_arg_value< char_type > named_args
Definition base.h:2183
constexpr FMT_INLINE value(signed char x)
Definition base.h:2187
constexpr FMT_INLINE value(unsigned x FMT_BUILTIN)
Definition base.h:2192
FMT_INLINE value(int128_opt x FMT_BUILTIN)
Definition base.h:2199
constexpr FMT_INLINE value(long long x FMT_BUILTIN)
Definition base.h:2196
char_type char_value
Definition base.h:2176
string_value< char_type > string
Definition base.h:2181
typename Context::char_type char_type
Definition base.h:2165
monostate no_value
Definition base.h:2168
FMT_INLINE value(void *x FMT_BUILTIN)
Definition base.h:2240
constexpr FMT_INLINE value(unsigned short x FMT_BUILTIN)
Definition base.h:2190
const void * pointer
Definition base.h:2180
value(const T &x)
Definition base.h:2259
unsigned uint_value
Definition base.h:2170
FMT_INLINE value(nullptr_t)
Definition base.h:2246
constexpr FMT_INLINE value(bool x FMT_BUILTIN)
Definition base.h:2201
long long long_long_value
Definition base.h:2171
constexpr FMT_INLINE value(signed short x)
Definition base.h:2189
auto get() const -> Locale
Definition format-inl.h:67
Parsing context consisting of a format string range being parsed and an argument counter for automati...
Definition base.h:850
const Char * iterator
Definition base.h:861
constexpr auto begin() const noexcept -> iterator
Returns an iterator to the beginning of the format string range being parsed.
Definition base.h:869
FMT_CONSTEXPR void check_arg_id(basic_string_view< Char >)
Definition base.h:901
FMT_CONSTEXPR void check_dynamic_spec(int arg_id)
Definition base.h:2459
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:893
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:881
constexpr parse_context(basic_string_view< Char > fmt, int next_arg_id=0)
Definition base.h:863
FMT_CONSTEXPR void advance_to(iterator it)
Advances the begin iterator to it.
Definition base.h:875
Char char_type
Definition base.h:860
constexpr auto end() const noexcept -> iterator
Returns an iterator past the end of the format string range being parsed.
Definition base.h:872
auto invoke_back_inserter() -> decltype(back_inserter(std::declval< Container & >()))
Converts a string literal into a format string that will be parsed at compile time and converted into...
Definition printf.h:50
FMT_CONSTEXPR auto code_point_length(const Char *begin) -> int
Definition base.h:1303
auto get_iterator(Buf &buf, OutputIt) -> decltype(buf.out())
Definition base.h:2126
@ is_unpacked_bit
Definition base.h:2315
FMT_CONSTEXPR auto compare(const Char *s1, const Char *s2, size_t n) -> int
Definition base.h:467
conditional_t< long_short, int, long long > long_type
Definition base.h:1126
FMT_CONSTEXPR auto is_locking() -> bool
Definition base.h:2428
constexpr auto to_ascii(Char c) -> char
Definition base.h:1297
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:1400
FMT_CONSTEXPR void ignore_unused(const T &...)
Definition base.h:358
constexpr auto count_static_named_args() -> int
Definition base.h:1079
void vprint_mojibake(FILE *, string_view, const format_args &, bool)
Definition base.h:2442
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:1442
void init_named_arg(named_arg_info< Char > *, int &arg_index, int &, const T &)
Definition base.h:1099
uint128_opt
Definition base.h:411
constexpr auto is_integral_type(type t) -> bool
Definition base.h:1022
constexpr auto count_named_args() -> int
Definition base.h:1076
FMT_CONSTEXPR auto parse_nonnegative_int(const Char *&begin, const Char *end, int error_value) noexcept -> int
Definition base.h:1312
constexpr auto digits10() noexcept -> int
Definition format.h:1141
FMT_CONSTEXPR void init_static_named_arg(named_arg_info< Char > *, int &arg_index, int &)
Definition base.h:1111
FMT_CONSTEXPR auto invoke_parse(parse_context< Char > &ctx) -> const Char *
Definition base.h:1684
conditional_t< long_short, unsigned, unsigned long long > ulong_type
Definition base.h:1127
int128_opt
Definition base.h:410
FMT_CONSTEXPR auto to_unsigned(Int value) -> make_unsigned_t< Int >
Definition base.h:432
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:1343
constexpr auto in(type t, int set) -> bool
Definition base.h:1030
FMT_CONSTEXPR auto check_char_specs(const format_specs &specs) -> bool
Definition base.h:1666
@ max_packed_args
Definition base.h:2314
FMT_CONSTEXPR void check_for_duplicate(named_arg_info< Char > *named_args, int named_arg_index, basic_string_view< Char > arg_name)
Definition base.h:1090
@ is_utf8_enabled
Definition base.h:451
auto map(int128_opt) -> monostate
Definition base.h:413
constexpr auto narrow(T *) -> char *
Definition base.h:461
constexpr auto is_constant_evaluated(bool default_value=false) noexcept -> bool
Definition base.h:360
constexpr auto is_arithmetic_type(type t) -> bool
Definition base.h:1025
@ long_short
Definition base.h:1125
FMT_ALWAYS_INLINE constexpr auto const_check(T val) -> T
Definition base.h:377
@ has_named_args_bit
Definition base.h:2316
FMT_CONSTEXPR void parse_format_string(basic_string_view< Char > fmt, Handler &&handler)
Definition base.h:1646
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:1433
FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt
Definition base.h:2068
FMT_FUNC void vformat_to(buffer< char > &buf, string_view fmt, format_args args, locale_ref loc)
Definition format-inl.h:1456
decltype(detail::type_mapper< Char >::map(std::declval< T & >())) mapped_t
Definition base.h:1230
FMT_CONSTEXPR auto parse_align(const Char *begin, const Char *end, format_specs &specs) -> const Char *
Definition format.h:2300
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< U >::value > use_formatter
Definition base.h:1153
@ bool_set
Definition base.h:1040
@ uint_set
Definition base.h:1038
@ pointer_set
Definition base.h:1046
@ float_set
Definition base.h:1042
@ cstring_set
Definition base.h:1045
@ char_set
Definition base.h:1041
@ sint_set
Definition base.h:1036
@ string_set
Definition base.h:1044
remove_cvref_t< decltype(format_as(std::declval< const T & >()))> format_as_result
Definition base.h:1130
typename V::value_type char_t
String's character (code unit) type. detail:: is intentional to prevent ADL.
Definition base.h:973
constexpr auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition base.h:948
FMT_CONSTEXPR auto parse_arg_id(const Char *begin, const Char *end, Handler &&handler) -> const Char *
Definition base.h:1348
state
Definition base.h:1457
@ use_utf8
Definition base.h:452
conditional_t< NUM_ARGS<=max_packed_args, value< Context >, basic_format_arg< Context > > arg_t
Definition base.h:2346
type
Definition base.h:975
auto get_buffer(OutputIt out) -> iterator_buffer< OutputIt, T >
Definition base.h:2116
FMT_CONSTEXPR FMT_INLINE auto parse_replacement_field(const Char *begin, const Char *end, Handler &&handler) -> const Char *
Definition base.h:1599
constexpr auto count() -> int
Definition base.h:1071
@ packed_arg_bits
Definition base.h:2312
constexpr auto has_formatter() -> bool
Definition base.h:1165
constexpr auto make_descriptor() -> unsigned long long
Definition base.h:2340
remove_cvref_t< decltype(formatter< T >::format_as(std::declval< const T & >()))> format_as_member_result
Definition base.h:1133
conditional_t< sizeof(Char)==1, unsigned char, unsigned > unsigned_char
Definition base.h:438
constexpr auto encode_types() -> unsigned long long
Definition base.h:2329
FMT_NORETURN FMT_API void assert_fail(const char *file, int line, const char *message)
std::integral_constant< type, Context::builtin_types||TYPE==type::int_type ? TYPE :type::custom_type > stored_type_constant
Definition base.h:1239
FMT_CONSTEXPR20 auto get_container(OutputIt it) -> typename OutputIt::container_type &
Definition base.h:495
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:1461
Definition PointerIntPair.h:280
constexpr buffer_traits(size_t)
Definition base.h:1869
constexpr auto limit(size_t size) const -> size_t
Definition base.h:1871
constexpr auto count() const -> size_t
Definition base.h:1870
void(* format)(void *arg, parse_context< char_type > &parse_ctx, Context &ctx)
Definition base.h:2146
typename Context::char_type char_type
Definition base.h:2144
void * value
Definition base.h:2145
arg_ref< Char > & ref
Definition base.h:1377
FMT_CONSTEXPR void on_index(int id)
Definition base.h:1380
FMT_CONSTEXPR void on_name(basic_string_view< Char > id)
Definition base.h:1386
arg_id_kind & kind
Definition base.h:1378
parse_context< Char > & ctx
Definition base.h:1376
Definition format-inl.h:57
int id
Definition base.h:1085
const Char * name
Definition base.h:1084
FMT_CONSTEXPR FMT_ALWAYS_INLINE named_arg_store(T &... values)
Definition base.h:2358
named_arg_store(named_arg_store &&rhs)
Definition base.h:2365
named_arg_store(const named_arg_store &rhs)=delete
arg_t< Context, NUM_ARGS > args[1u+NUM_ARGS]
Definition base.h:2353
named_arg_info< typename Context::char_type > named_args[static_cast< size_t >(NUM_NAMED_ARGS)]
Definition base.h:2355
auto operator=(const named_arg_store &rhs) -> named_arg_store &=delete
auto operator=(named_arg_store &&rhs) -> named_arg_store &=delete
const named_arg_info< Char > * data
Definition base.h:2150
size_t size
Definition base.h:2151
const T & value
Definition base.h:1065
const Char * name
Definition base.h:1064
named_arg(const Char *n, const T &v)
Definition base.h:1067
const Char * end
Definition base.h:1394
arg_id_kind kind
Definition base.h:1395
const Char * data
Definition base.h:2138
auto str() const -> basic_string_view< Char >
Definition base.h:2140
size_t size
Definition base.h:2139
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:2722
string_view str
Definition base.h:2734
auto get() const -> string_view
Definition base.h:2776
fstring(runtime_format_string<> fmt)
Definition base.h:2772
FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const char(&s)[N])
Definition base.h:2739
FMT_ALWAYS_INLINE fstring(const S &)
Definition base.h:2766
FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const S &s)
Definition base.h:2753
constexpr monostate()
Definition base.h:332
FMT_CONSTEXPR arg_ref(int idx=0)
Definition base.h:1280
int index
Definition base.h:1283
basic_string_view< Char > name
Definition base.h:1284
FMT_CONSTEXPR arg_ref(basic_string_view< Char > n)
Definition base.h:1281
#define S(label, offset, message)
Definition Errors.h:113