[#index] = Global namespace :mrdocs: == Namespaces [cols="1,4"] |=== | Name| Description | xref:fmt.adoc[`fmt`] | Top‐level namespace for the {fmt} formatting library, wrapping all public API in the inline namespace `v12` used to version the library's ABI. |=== == Macros [cols="1,4"] |=== | Name| Description | xref:FMT_STATIC_FORMAT.adoc[`FMT_STATIC_FORMAT`] | Formats arguments according to the format string `fmt_str` and produces a string of the exact required size at compile time. Both the format string and the arguments must be compile‐time expressions. |=== == xref:fmt.adoc[fmt] namespace Top‐level namespace for the {fmt} formatting library, wrapping all public API in the inline namespace `v12` used to version the library's ABI. === Namespaces [cols="1,4"] |=== | Name| Description | xref:fmt/enums.adoc[`enums`] | Contains `format_as` overloads that make enum types formattable by converting them to their underlying type. | xref:fmt/safe_duration_cast.adoc[`safe_duration_cast`] | Helpers for converting between `std::chrono::duration` types without undefined behavior or erroneous results due to overflow. |=== === Types [cols="1,4"] |=== | Name| Description | xref:fmt/basic_appender.adoc[`basic_appender`] | An output iterator that appends to a buffer. It is used instead of `back_insert_iterator` to reduce symbol sizes and avoid the `<iterator>` dependency. | xref:fmt/basic_cstring_view.adoc[`basic_cstring_view`] | A reference to a null‐terminated string. It can be constructed from a C string or `std::string`. | xref:fmt/basic_format_arg.adoc[`basic_format_arg`] | A formatting argument. `Context` is a template parameter for the compiled API where output can be unbuffered. | xref:fmt/basic_format_args.adoc[`basic_format_args`] | A view of a collection of formatting arguments. To avoid lifetime issues it should only be used as a parameter type in type‐erased functions such as `vformat`: | xref:fmt/basic_fstring.adoc[`basic_fstring`] | A `Char` counterpart of `fstring`. Use `basic_format_string` in the public API to prevent type deduction. | xref:fmt/basic_memory_buffer.adoc[`basic_memory_buffer`] | A dynamically growing memory buffer for trivially copyable/constructible types with the first `SIZE` elements stored in the object itself. Most commonly used via the `memory_buffer` alias for `char`. | xref:fmt/basic_ostream_formatter.adoc[`basic_ostream_formatter`] | Formats an object of type T that has an overloaded ostream operator<<. | xref:fmt/basic_printf_context.adoc[`basic_printf_context`] | The formatting context used to evaluate `printf`‐style format strings. | xref:fmt/basic_specs.adoc[`basic_specs`] | Basic format specifiers for built‐in and string types. | xref:fmt/basic_string_view.adoc[`basic_string_view`] | An implementation of `std::basic_string_view` for pre‐C++17 providing a subset of the API. `fmt::basic_string_view` is used in the public API even if `std::basic_string_view` is available to prevent issues when a library is compiled with a different `‐std` option than the client code (which is not recommended). | xref:fmt/buffered_file.adoc[`buffered_file`] | A buffered file. | xref:fmt/bytes.adoc[`bytes`] | A view over a `string_view` that formats its contents as raw bytes rather than as text. | xref:fmt/compiled_string.adoc[`compiled_string`] | A compile‐time string which is compiled into fast formatting code. | xref:fmt/conjunction-03.adoc[`conjunction`] | Logical AND of a list of traits, each exposing a `value` bool constant, short‐circuiting like `std::conjunction`. | xref:fmt/context.adoc[`context`] | A formatting context. | xref:fmt/dynamic_format_arg_store.adoc[`dynamic_format_arg_store`] | A dynamic list of formatting arguments with storage. | xref:fmt/file.adoc[`file`] | A file. A closed file is represented by a file object with descriptor ‐1. Methods that are not declared with noexcept may throw `fmt::system_error` in case of failure. | xref:fmt/format_error.adoc[`format_error`] | An error reported from a formatting function. | xref:fmt/format_facet-03.adoc[`format_facet`] | A locale facet that formats values in UTF‐8. It is parameterized on the locale to avoid the heavy <locale> include. | xref:fmt/format_int.adoc[`format_int`] | A fast integer formatter. | xref:fmt/format_specs.adoc[`format_specs`] | Format specifiers for built‐in and string types. | xref:fmt/format_to_n_result.adoc[`format_to_n_result`] | The result of `format_to_n`. | xref:fmt/format_to_result.adoc[`format_to_result`] | The result of `format_to` writing into a fixed‐size character array. | xref:fmt/formatter-030.adoc[`formatter`] | A formatter for objects of type `T`. | xref:fmt/fstring.adoc[`fstring`] | A compile‐time format string. Use `format_string` in the public API to prevent type deduction. | xref:fmt/generic_context.adoc[`generic_context`] | The format context implementation used for output iterators other than `appender`, type‐erasing the output iterator and character types. | xref:fmt/group_digits_view.adoc[`group_digits_view`] | A view holding an integer value to be formatted with digit grouping. | xref:fmt/is_compiled_string.adoc[`is_compiled_string`] | A trait that detects whether `S` is a compile‐time string produced by `FMT_COMPILE`, i.e. derives from `compiled_string`. | xref:fmt/is_container_adaptor.adoc[`is_container_adaptor`] | Specifies if `T` is a container adaptor (like `std::stack`) that should be formatted as the underlying container. | xref:fmt/is_contiguous-03.adoc[`is_contiguous`] | Detects whether `T` stores its elements contiguously in memory. | xref:fmt/is_range.adoc[`is_range`] | Detects whether `T` is a range that should be formatted as a range, i.e. it has `begin`/`end` but is not optional‐like or string‐like. | xref:fmt/is_tuple_formattable.adoc[`is_tuple_formattable`] | Detects whether every element of tuple‐like type `T` is formattable with character type `C`. | xref:fmt/is_tuple_like-06.adoc[`is_tuple_like`] | Detects whether `T` is a tuple‐like type (supports `std::tuple_size`) that is not also a range. | xref:fmt/is_variant_like.adoc[`is_variant_like`] | Detects whether `T` is a variant‐like type, i.e. exposes the `std::variant`‐style `index()`/`std::visit` interface. | xref:fmt/join_view.adoc[`join_view`] | A view over the iterator range `[begin, end)]` that formats its elements separated by `sep`, produced by `fmt::join`. | xref:fmt/loc_value.adoc[`loc_value`] | A type‐erased formatting argument passed to a `format_facet` for locale‐aware formatting. | xref:fmt/locale_ref.adoc[`locale_ref`] | A type‐erased reference to std::locale to avoid the heavy <locale> include. | xref:fmt/locking.adoc[`locking`] | Detects whether formatting an object of type `T` requires locking, e.g. because it accesses global state such as the current locale. | xref:fmt/monostate.adoc[`monostate`] | An empty placeholder type used where a value is required by the API but carries no information, e.g. as the mapped type for arguments that don't match any supported formatting type. | xref:fmt/nested_formatter.adoc[`nested_formatter`] | Base class for formatters that nest another formatter and support applying a width and alignment to its overall output, such as `formatter<std::pair<T, U>>`. | xref:fmt/nested_view.adoc[`nested_view`] | Pairs a value with the formatter that should be used to format it, so it can be formatted through a `formatter<nested_view<T, Char>, Char>` specialization by an enclosing formatter. | xref:fmt/parse_context-0a.adoc[`parse_context`] | Parsing context consisting of a format string range being parsed and an argument counter for automatic indexing. | xref:fmt/path.adoc[`path`] | A `std::filesystem::path` subclass whose `string()`‐like accessors return UTF‐8 encoded strings regardless of platform. | xref:fmt/range_format_kind.adoc[`range_format_kind`] | Determines the `range_format` used to format `T`, e.g. `map`, `set`, `string`, or `disabled` if `T` is not a formattable range. | xref:fmt/range_formatter-02.adoc[`range_formatter`] | Formats a range as a bracketed, separator‐delimited sequence of its elements. | xref:fmt/rgb.adoc[`rgb`] | A color represented as separate red, green, and blue components. | xref:fmt/runtime_format_string.adoc[`runtime_format_string`] | A format string that skips compile‐time checks and is validated at runtime instead, as returned by `runtime`. | xref:fmt/static_format_result.adoc[`static_format_result`] | Holds a null‐terminated string of exactly `N ‐ 1` characters, produced by formatting a compiled format string at compile time. | xref:fmt/string_buffer.adoc[`string_buffer`] | A `std::string`‐backed buffer that can be converted to a `writer`. | xref:fmt/text_style.adoc[`text_style`] | A text style consisting of foreground and background colors and emphasis. | xref:fmt/tuple_join_view.adoc[`tuple_join_view`] | A view over `tuple` that formats its elements separated by `sep`, produced by `fmt::join`. | xref:fmt/vprintf_args.adoc[`vprintf_args`] | A helper that maps a character type to the type‐erased argument list used with `basic_printf_context<Char>`. | xref:fmt/writer.adoc[`writer`] | A writer to a buffered stream. It doesn't own the underlying stream. |=== === Type Aliases [cols="1,4"] |=== | Name| Description | xref:fmt/appender.adoc[`appender`] | A `basic_appender` specialized for `char`. | xref:fmt/basic_format_context.adoc[`basic_format_context`] | Format context type for a given output iterator and character type, resolving to `context` when `OutputIt` is `appender` and to `generic_context<OutputIt, Char>` otherwise. | xref:fmt/basic_format_parse_context.adoc[`basic_format_parse_context`] | Alias of `parse_context<Char>` kept for C++20 `std::format` compatibility. | xref:fmt/basic_format_string.adoc[`basic_format_string`] | A format string for character type `Char` that is validated at compile time. | xref:fmt/bool_constant.adoc[`bool_constant`] | Alias for `std::integral_constant<bool, B>`, provided for compilers that predate C++17's `std::bool_constant`. | xref:fmt/buffered_context.adoc[`buffered_context`] | Format context type used by `fmt::format` overloads that write through a `back_insert_iterator`, resolving to `context` for `char` and to `generic_context<basic_appender<Char>, Char>` otherwise. | xref:fmt/conditional_t.adoc[`conditional_t`] | Alias for `std::conditional<B, T, F>::type`, provided for compilers that predate C++14's `std::conditional_t`. | xref:fmt/cstring_view.adoc[`cstring_view`] | A `basic_cstring_view` for `char` strings. | xref:fmt/day.adoc[`day`] | | xref:fmt/decay_t.adoc[`decay_t`] | Alias for `std::decay<T>::type`, provided for compilers that predate C++14's `std::decay_t`. | xref:fmt/enable_if_t.adoc[`enable_if_t`] | Alias for `std::enable_if<B, T>::type`, provided for compilers that predate C++14's `std::enable_if_t`. | xref:fmt/format_args.adoc[`format_args`] | Alias of `basic_format_args<context>` used by the default format API. | xref:fmt/format_context.adoc[`format_context`] | Alias of `context` kept for C++20 `std::format` compatibility. | xref:fmt/format_parse_context.adoc[`format_parse_context`] | Alias of `parse_context<char>` kept for C++20 `std::format` compatibility. | xref:fmt/format_string.adoc[`format_string`] | A format string that is validated at compile time. | xref:fmt/is_formattable.adoc[`is_formattable`] | A trait indicating whether `T` can be formatted with character type `Char`. | xref:fmt/local_time.adoc[`local_time`] | A time point on the local clock, with the given `Duration` resolution. | xref:fmt/make_unsigned_t.adoc[`make_unsigned_t`] | Alias for `std::make_unsigned<T>::type`, provided for compilers that predate C++14's `std::make_unsigned_t`. | xref:fmt/memory_buffer.adoc[`memory_buffer`] | A memory buffer for `char` with the default inline capacity. | xref:fmt/month.adoc[`month`] | | xref:fmt/named_arg.adoc[`named_arg`] | An argument bound to a name, as returned by `fmt::arg`, that lets a format string refer to it by name instead of by position. | xref:fmt/nullptr_t.adoc[`nullptr_t`] | The type of the `nullptr` literal. | xref:fmt/ostream_formatter.adoc[`ostream_formatter`] | A `basic_ostream_formatter` for `char` strings. | xref:fmt/printf_args.adoc[`printf_args`] | The type‐erased argument list used with `printf_context`. | xref:fmt/printf_context.adoc[`printf_context`] | A `basic_printf_context` for `char` strings. | xref:fmt/remove_const_t.adoc[`remove_const_t`] | Alias for `std::remove_const<T>::type`, provided for compilers that predate C++14's `std::remove_const_t`. | xref:fmt/remove_cvref_t.adoc[`remove_cvref_t`] | Alias for `std::remove_cv<std::remove_reference<T>::type>::type`, provided for compilers that predate C++20's `std::remove_cvref_t`. | xref:fmt/remove_reference_t.adoc[`remove_reference_t`] | Alias for `std::remove_reference<T>::type`, provided for compilers that predate C++14's `std::remove_reference_t`. | xref:fmt/string_view.adoc[`string_view`] | A `basic_string_view` specialized for `char`. | xref:fmt/sys_time.adoc[`sys_time`] | A time point on the system clock, with the given `Duration` resolution. | xref:fmt/ullong.adoc[`ullong`] | Alias for `unsigned long long`. | xref:fmt/underlying_t.adoc[`underlying_t`] | Alias for `std::underlying_type<T>::type`, provided for compilers that predate C++14's `std::underlying_type_t`. | xref:fmt/utc_time.adoc[`utc_time`] | A time point on the UTC clock, with the given `Duration` resolution. | xref:fmt/vargs.adoc[`vargs`] | The type returned by `make_format_args` for the default `context`. | xref:fmt/void_t.adoc[`void_t`] | Alias that maps any set of types to `void`, used to detect the validity of an expression in SFINAE contexts. | xref:fmt/wcstring_view.adoc[`wcstring_view`] | A `basic_cstring_view` for `wchar_t` strings. | xref:fmt/weekday.adoc[`weekday`] | | xref:fmt/wformat_args.adoc[`wformat_args`] | A `wchar_t` counterpart of `format_args`. | xref:fmt/wformat_context.adoc[`wformat_context`] | A `wchar_t` counterpart of `context`. | xref:fmt/wformat_parse_context.adoc[`wformat_parse_context`] | A `wchar_t` counterpart of `format_parse_context`. | xref:fmt/wformat_string.adoc[`wformat_string`] | A `wchar_t` counterpart of `format_string`. | xref:fmt/wmemory_buffer.adoc[`wmemory_buffer`] | A `wchar_t` counterpart of `memory_buffer`. | xref:fmt/wprintf_args.adoc[`wprintf_args`] | The type‐erased argument list used with `wprintf_context`. | xref:fmt/wprintf_context.adoc[`wprintf_context`] | A `basic_printf_context` for `wchar_t` strings. | xref:fmt/wstring_view.adoc[`wstring_view`] | A `wchar_t` counterpart of `string_view`. | xref:fmt/year.adoc[`year`] | | xref:fmt/year_month_day.adoc[`year_month_day`] | |=== === Enums [cols="1,4"] |=== | Name| Description | xref:fmt/_04enum.adoc[`Unnamed enum`] | The number of characters to store in the basic_memory_buffer object itself to avoid dynamic memory allocation. | xref:fmt/align.adoc[`align`] | The alignment of a formatted value within its field width. | xref:fmt/arg_id_kind.adoc[`arg_id_kind`] | The kind of dynamic argument, if any, used to supply a field width or precision. | xref:fmt/color.adoc[`color`] | A named color from the extended CSS/X11 color set, encoded as a packed 0xRRGGBB value. | xref:fmt/emphasis.adoc[`emphasis`] | A bitmask of text emphasis styles that can be combined with `operator|`. | xref:fmt/presentation_type.adoc[`presentation_type`] | The presentation type of a format specifier, encoding which of the mutually exclusive type letters (e.g. 'd', 'x', 'f', 's') was used. Enumerators for unrelated categories (integral/character, string/pointer, floating‐point) intentionally share numeric values because at most one category applies to a given argument type. | xref:fmt/range_format.adoc[`range_format`] | The style used to format a range or range‐like type. | xref:fmt/sign.adoc[`sign`] | The sign specifier controlling how the sign of a numeric value is formatted. | xref:fmt/terminal_color.adoc[`terminal_color`] | Terminal colors that map to the standard ANSI SGR foreground color codes. |=== === Functions [cols="1,4"] |=== | Name| Description | xref:fmt/arg-0e.adoc[`arg`] | `arg` overloads | xref:fmt/assert_fail.adoc[`assert_fail`] [.small]#[noreturn]# | Reports an assertion failure, used by the `FMT_ASSERT` macro when `condition` evaluates to false. | xref:fmt/bg.adoc[`bg`] | Creates a text style from the background color. | xref:fmt/fg.adoc[`fg`] | Creates a text style from the foreground (text) color. | xref:fmt/format-021.adoc[`format`] | `format` overloads | xref:fmt/format_system_error.adoc[`format_system_error`] | Formats an error message for an error returned by an operating system or a language runtime, for example a file opening error, and writes it to `out`. The format is the same as the one used by `std::system_error(ec, message)` where `ec` is `std::error_code(error_code, std::generic_category())`. It is implementation‐defined but normally looks like: | xref:fmt/format_to-0da.adoc[`format_to`] | `format_to` overloads | xref:fmt/format_to_n-0b.adoc[`format_to_n`] | `format_to_n` overloads | xref:fmt/formatted_size-0e.adoc[`formatted_size`] | `formatted_size` overloads | xref:fmt/fprintf-0b.adoc[`fprintf`] | `fprintf` overloads | xref:fmt/gmtime-03.adoc[`gmtime`] | `gmtime` overloads | xref:fmt/group_digits.adoc[`group_digits`] | Returns a view that formats an integer value using ',' as a locale‐independent thousands separator. | xref:fmt/join-03.adoc[`join`] | `join` overloads | xref:fmt/make_format_args.adoc[`make_format_args`] | Constructs an object that stores references to arguments and can be implicitly converted to `format_args`. `Context` can be omitted in which case it defaults to `context`. See `arg` for lifetime considerations. | xref:fmt/make_printf_args.adoc[`make_printf_args`] | Constructs an `format_arg_store` object that contains references to arguments and can be implicitly converted to `printf_args`. | xref:fmt/make_wformat_args.adoc[`make_wformat_args`] | A `wchar_t` counterpart of `make_format_args`. | xref:fmt/max_of.adoc[`max_of`] | Returns the larger of `a` and `b`. | xref:fmt/min_of.adoc[`min_of`] | Returns the smaller of `a` and `b`. | xref:fmt/operator_a.adoc[`operator""_a`] | User‐defined literal equivalent of `fmt::arg`, but with compile‐time checks. | xref:fmt/operator_cf.adoc[`operator""_cf`] | Converts a string literal into a format string that will be parsed at compile time and converted into efficient formatting code. Requires support for class types in constant template parameters (a C++20 feature). | xref:fmt/operator_bitor-08.adoc[`operator|`] | Bitwise disjunction operators | xref:fmt/print-02c.adoc[`print`] | `print` overloads | xref:fmt/printf.adoc[`printf`] | Formats `args` according to specifications in `fmt` and writes the output to `stdout`. | xref:fmt/println-0d.adoc[`println`] | `println` overloads | xref:fmt/ptr-06.adoc[`ptr`] | `ptr` overloads | xref:fmt/report_error.adoc[`report_error`] [.small]#[noreturn]# | Reports a format error at compile time or, via a `format_error` exception, at runtime. | xref:fmt/report_system_error.adoc[`report_system_error`] | Reports a system error without throwing an exception. Can be used to report errors from destructors. | xref:fmt/runtime-0c3.adoc[`runtime`] | `runtime` overloads | xref:fmt/sprintf-05.adoc[`sprintf`] | `sprintf` overloads | xref:fmt/streamed.adoc[`streamed`] | Returns a view that formats `value` via an ostream `operator<<`. | xref:fmt/styled.adoc[`styled`] | Returns an argument that will be formatted using ANSI escape sequences, to be used in a formatting function. | xref:fmt/system_category.adoc[`system_category`] | Returns the system error category used to construct `std::system_error` objects on non‐Windows platforms. | xref:fmt/system_error.adoc[`system_error`] | Constructs `std::system_error` with a message formatted with `fmt::format(fmt, args...)`. `error_code` is a system error code as given by `errno`. | xref:fmt/to_string-0b.adoc[`to_string`] | `to_string` overloads | xref:fmt/to_wstring.adoc[`to_wstring`] | Converts `value` to `std::wstring` using the default format for type `T`. | xref:fmt/underlying.adoc[`underlying`] | Converts `e` to the underlying type. | xref:fmt/vformat-02.adoc[`vformat`] | `vformat` overloads | xref:fmt/vformat_to-0b.adoc[`vformat_to`] | `vformat_to` overloads | xref:fmt/vformat_to_n-01.adoc[`vformat_to_n`] | `vformat_to_n` overloads | xref:fmt/vfprintf.adoc[`vfprintf`] | Formats `args` according to specifications in `fmt` and writes the output to the file `f`. | xref:fmt/vprint-00.adoc[`vprint`] | `vprint` overloads | xref:fmt/vprint_buffered.adoc[`vprint_buffered`] | Formats `args` according to specifications in `fmt` into a buffer and writes the buffer to the file `f` in a single write. | xref:fmt/vprintln-08d.adoc[`vprintln`] | `vprintln` overloads | xref:fmt/vsprintf.adoc[`vsprintf`] | Formats `args` according to specifications in `fmt` and returns the result as a string. | xref:fmt/vsystem_error.adoc[`vsystem_error`] | Constructs `std::system_error` with a message formatted with `fmt::vformat(fmt, args)`. | xref:fmt/operator_eq.adoc[`operator==`] | `true` if `lhs` and `rhs` are equal. | xref:fmt/operator_not_eq.adoc[`operator!=`] | `true` if `lhs` and `rhs` are not equal. | xref:fmt/operator_lt.adoc[`operator<`] | `true` if `lhs` is lexicographically less than `rhs`. | xref:fmt/operator_le.adoc[`operator<=`] | `true` if `lhs` is lexicographically less than or equal to. | xref:fmt/operator_gt.adoc[`operator>`] | `true` if `lhs` is lexicographically greater than `rhs`. | xref:fmt/operator_ge.adoc[`operator>=`] | `true` if `lhs` is lexicographically greater than or equal to. |=== === Concepts [cols="1,4"] |=== | Name| Description | xref:fmt/formattable.adoc[`formattable`] | A concept satisfied by types that can be formatted with character type `Char`. |=== == xref:fmt/enums.adoc[fmt::enums] namespace Contains `format_as` overloads that make enum types formattable by converting them to their underlying type. === Functions [cols="1,4"] |=== | Name| Description | xref:fmt/enums/format_as.adoc[`format_as`] | Converts `e` to its underlying type so that enum types are formattable by default via argument‐dependent lookup. |=== == xref:fmt/safe_duration_cast.adoc[fmt::safe_duration_cast] namespace Helpers for converting between `std::chrono::duration` types without undefined behavior or erroneous results due to overflow. === Functions [cols="1,4"] |=== | Name| Description | xref:fmt/safe_duration_cast/lossless_integral_conversion-0f.adoc[`lossless_integral_conversion`] | `lossless_integral_conversion` overloads | xref:fmt/safe_duration_cast/safe_duration_cast.adoc[`safe_duration_cast`] | Safe duration_cast between floating point durations | xref:fmt/safe_duration_cast/safe_float_conversion-03.adoc[`safe_float_conversion`] | `safe_float_conversion` overloads |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#