Name |
---|
fmt |
Name |
---|
enums |
safe_duration_cast |
Name |
---|
Unnamed enum |
align |
arg_id_kind |
color |
emphasis |
presentation_type |
range_format |
sign |
terminal_color |
Name | Description |
---|---|
Unnamed overloads | |
arg | Returns a named argument to be used in a formatting function. It should only be used in a call to a formatting function. |
assert_fail | |
bg | Creates a text style from the background color. |
fg | Creates a text style from the foreground (text) color. |
format | format overloads |
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: |
format_to | format_to overloads |
format_to_n | Formats args according to specifications in fmt , writes up to n characters of the result to the output iterator out and returns the total (not truncated) output size and the iterator past the end of the output range. format_to_n does not append a terminating null character. |
formatted_size | Returns the number of chars in the output of format(fmt, args...) . |
fprintf | Formats args according to specifications in fmt and writes the output to f . |
gmtime | Converts given time since epoch as std::time_t value into calendar time, expressed in Coordinated Universal Time (UTC). Unlike std::gmtime , this function is thread-safe on most platforms. |
group_digits | Returns a view that formats an integer value using ',' as a locale-independent thousands separator. |
join | join overloads |
make_format_args | |
make_printf_args | Constructs an format_arg_store object that contains references to arguments and can be implicitly converted to printf_args . |
make_wformat_args | |
max_of | |
min_of | |
operator| | Bitwise disjunction operators |
print | print overloads |
printf | Formats args according to specifications in fmt and writes the output to stdout . |
println | println overloads |
ptr | Converts p to const void* for pointer formatting. |
report_error | Reports a format error at compile time or, via a format_error exception, at runtime. |
report_system_error | |
runtime | Creates a runtime format string. |
sprintf | Formats args according to specifications in fmt and returns the result as as string. |
streamed | Returns a view that formats value via an ostream operator<< . |
styled | Returns an argument that will be formatted using ANSI escape sequences, to be used in a formatting function. |
system_category | |
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 . |
to_string | Converts value to std::string using the default format for type T . |
to_wstring | Converts value to std::wstring using the default format for type T . |
underlying | Converts e to the underlying type. |
vformat | |
vformat_to | vformat_to overloads |
vformat_to_n | |
vfprintf | |
vprint | |
vprint_buffered | |
vprintln | |
vsprintf | |
vsystem_error | |
operator== | Equality operator |
operator!= | Inequality operator |
operator< | Less-than operator |
operator<= | Less-than-or-equal operator |
operator> | Greater-than operator |
operator>= | Greater-than-or-equal operator |
Name |
---|
formattable |
Name |
---|
format_as |
Name | Description |
---|---|
lossless_integral_conversion | Converts From to To, without loss. If the dynamic value of from can't be converted to To without loss, ec is set. |
safe_duration_cast | Safe duration_cast between floating point durations |
safe_float_conversion | converts From to To if possible, otherwise ec is set. |
Name |
---|
enums |
safe_duration_cast |
Name |
---|
Unnamed enum |
align |
arg_id_kind |
color |
emphasis |
presentation_type |
range_format |
sign |
terminal_color |
Name | Description |
---|---|
Unnamed overloads | |
arg | Returns a named argument to be used in a formatting function. It should only be used in a call to a formatting function. |
assert_fail | |
bg | Creates a text style from the background color. |
fg | Creates a text style from the foreground (text) color. |
format | format overloads |
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: |
format_to | format_to overloads |
format_to_n | Formats args according to specifications in fmt , writes up to n characters of the result to the output iterator out and returns the total (not truncated) output size and the iterator past the end of the output range. format_to_n does not append a terminating null character. |
formatted_size | Returns the number of chars in the output of format(fmt, args...) . |
fprintf | Formats args according to specifications in fmt and writes the output to f . |
gmtime | Converts given time since epoch as std::time_t value into calendar time, expressed in Coordinated Universal Time (UTC). Unlike std::gmtime , this function is thread-safe on most platforms. |
group_digits | Returns a view that formats an integer value using ',' as a locale-independent thousands separator. |
join | join overloads |
make_format_args | |
make_printf_args | Constructs an format_arg_store object that contains references to arguments and can be implicitly converted to printf_args . |
make_wformat_args | |
max_of | |
min_of | |
operator| | Bitwise disjunction operators |
print | print overloads |
printf | Formats args according to specifications in fmt and writes the output to stdout . |
println | println overloads |
ptr | Converts p to const void* for pointer formatting. |
report_error | Reports a format error at compile time or, via a format_error exception, at runtime. |
report_system_error | |
runtime | Creates a runtime format string. |
sprintf | Formats args according to specifications in fmt and returns the result as as string. |
streamed | Returns a view that formats value via an ostream operator<< . |
styled | Returns an argument that will be formatted using ANSI escape sequences, to be used in a formatting function. |
system_category | |
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 . |
to_string | Converts value to std::string using the default format for type T . |
to_wstring | Converts value to std::wstring using the default format for type T . |
underlying | Converts e to the underlying type. |
vformat | |
vformat_to | vformat_to overloads |
vformat_to_n | |
vfprintf | |
vprint | |
vprint_buffered | |
vprintln | |
vsprintf | |
vsystem_error | |
operator== | Equality operator |
operator!= | Inequality operator |
operator< | Less-than operator |
operator<= | Less-than-or-equal operator |
operator> | Greater-than operator |
operator>= | Greater-than-or-equal operator |
Name |
---|
formattable |
Name |
---|
format_as |
<fmt/format.h>
template<typename Enum>
constexpr
underlying_t<Enum>
format_as(Enum e) noexcept;
Name | Description |
---|---|
lossless_integral_conversion | Converts From to To, without loss. If the dynamic value of from can't be converted to To without loss, ec is set. |
safe_duration_cast | Safe duration_cast between floating point durations |
safe_float_conversion | converts From to To if possible, otherwise ec is set. |
Converts From to To, without loss. If the dynamic value of from can't be converted to To without loss, ec is set.
<fmt/chrono.h>
template<
typename To,
typename From>
constexpr
To
lossless_integral_conversion(
From const from,
int& ec);
» more...
Converts From to To, without loss. If the dynamic value of from can't be converted to To without loss, ec is set.
template<
typename To,
typename From>
constexpr
To
lossless_integral_conversion(
From const from,
int& ec);
» more...
template<
typename To,
typename From>
constexpr
To
lossless_integral_conversion(
From const from,
int& ec);
» more...
<fmt/chrono.h>
template<
typename To,
typename From>
constexpr
To
lossless_integral_conversion(
From const from,
int& ec);
Converts From to To, without loss. If the dynamic value of from can't be converted to To without loss, ec is set.
<fmt/chrono.h>
template<
typename To,
typename From>
constexpr
To
lossless_integral_conversion(
From const from,
int& ec);
<fmt/chrono.h>
template<
typename To,
typename From>
constexpr
To
lossless_integral_conversion(
From const from,
int& ec);
Safe duration_cast between floating point durations
<fmt/chrono.h>
template<
typename To,
typename FromRep,
typename FromPeriod>
To
safe_duration_cast(
std::chrono::duration<FromRep, FromPeriod> from,
int& ec);
converts From to To if possible, otherwise ec is set.
<fmt/chrono.h>
converts From to To if possible, otherwise ec is set.
template<
typename To,
typename From>
constexpr
To
safe_float_conversion(
From const from,
int& ec);
» more...
template<
typename To,
typename From>
constexpr
To
safe_float_conversion(
From const from,
int& ec);
» more...
converts From to To if possible, otherwise ec is set.
<fmt/chrono.h>
template<
typename To,
typename From>
constexpr
To
safe_float_conversion(
From const from,
int& ec);
input | output ---------------------------------|--------------- NaN | NaN Inf | Inf normal, fits in output | converted (possibly lossy) normal, does not fit in output | ec is set subnormal | best effort -Inf | -Inf
<fmt/chrono.h>
template<
typename To,
typename From>
constexpr
To
safe_float_conversion(
From const from,
int& ec);
<fmt/base.h>
template<
typename OutputIt,
typename Char>
using basic_format_context = conditional_t<std::is_same<OutputIt, appender>::value, context, generic_context<OutputIt, Char>>;
<fmt/base.h>
template<typename Char>
using basic_format_parse_context = parse_context<Char>;
<fmt/xchar.h>
template<
typename Char,
typename... T>
using basic_format_string = basic_fstring<Char, T...>;
<fmt/base.h>
template<bool B>
using bool_constant = std::integral_constant<bool, B>;
<fmt/base.h>
template<typename Char>
using buffered_context = conditional_t<std::is_same<Char, char>::value, context, generic_context<basic_appender<Char>, Char>>;
<fmt/base.h>
template<
bool B,
typename T,
typename F>
using conditional_t = std::conditional<B, T, F>::type;
<fmt/base.h>
template<typename T>
using decay_t = std::decay<T>::type;
<fmt/base.h>
template<
bool B,
typename T = void>
using enable_if_t = T;
<fmt/base.h>
template<typename... T>
using format_string = fstring<T...>::t;
<fmt/base.h>
template<
typename T,
typename Char = char>
using is_formattable = bool_constant<!std::is_same<detail::mapped_t<conditional_t<std::is_void<T>::value, int *, T>, Char>, void>::value>;
<fmt/chrono.h>
template<class Duration>
using local_time = std::chrono::time_point</* implementation-defined */, Duration>;
<fmt/base.h>
template<typename T>
using make_unsigned_t = std::make_unsigned<T>::type;
<fmt/base.h>
using nullptr_t = decltype(nullptr);
<fmt/base.h>
template<typename T>
using remove_const_t = std::remove_const<T>::type;
<fmt/base.h>
template<typename T>
using remove_cvref_t = std::remove_cv<remove_reference_t<T>>::type;
<fmt/base.h>
template<typename T>
using remove_reference_t = std::remove_reference<T>::type;
<fmt/chrono.h>
template<typename Duration>
using sys_time = std::chrono::time_point<std::chrono::system_clock, Duration>;
<fmt/base.h>
template<typename T>
using underlying_t = std::underlying_type<T>::type;
<fmt/chrono.h>
template<typename Duration>
using utc_time = std::chrono::time_point</* implementation-defined */, Duration>;
<fmt/base.h>
template<typename... T>
using vargs = /* implementation-defined */;
<fmt/base.h>
template<typename...>
using void_t = void;
<fmt/xchar.h>
template<typename... T>
using wformat_string = basic_format_string<wchar_t, T...>::t;
<fmt/base.h>
template<typename T>
class basic_appender;
Name |
---|
container_type |
Name | Description |
---|---|
basic_appender [constructor] | Construct from buffer |
operator= | Assignment operator |
operator* | Dereference operator |
operator++ | Increment operators |
Name |
---|
container |
<fmt/base.h>
using container_type = /* implementation-defined */;
Construct from buffer
<fmt/base.h>
constexpr
basic_appender(/* implementation-defined */& buf);
Name | Description |
---|---|
buf | The object to copy construct from |
Assignment operator
Name | Description |
---|---|
c | The object to assign from |
Dereference operator
Increment operators
<fmt/base.h>
Increment operator
constexpr
basic_appender&
operator++();
» more...
Increment operator
constexpr
basic_appender
operator++(int);
» more...
Increment operator
Increment operator
<fmt/base.h>
/* implementation-defined */* container;
A reference to a null-terminated string. It can be constructed from a C string or std::string
.
<fmt/os.h>
template<typename Char>
class basic_cstring_view;
Name | Description |
---|---|
basic_cstring_view [constructor] | Constructors |
c_str | Returns the pointer to a C string. |
You can use one of the following type aliases for common character types:
+---------------+-----------------------------+ | Type | Definition | +=+===+ | cstring_view | basic_cstring_view<char> | +---------------+-----------------------------+ | wcstring_view | basic_cstring_view<wchar_t> | +---------------+-----------------------------+
This class is most useful as a parameter type for functions that wrap C APIs.
Constructors
<fmt/os.h>
Constructs a string reference from an std::string
object.
basic_cstring_view(std::basic_string<Char> const& s);
» more...
Constructs a string reference object from a C string.
basic_cstring_view(Char const* s);
» more...
Constructs a string reference from an std::string
object.
<fmt/os.h>
basic_cstring_view(std::basic_string<Char> const& s);
Name | Description |
---|---|
s | The object to copy construct from |
Constructs a string reference object from a C string.
<fmt/os.h>
basic_cstring_view(Char const* s);
Name | Description |
---|---|
s | The object to construct from |
Returns the pointer to a C string.
<fmt/os.h>
Char const*
c_str() const;
<fmt/base.h>
template<typename Context>
class basic_format_arg;
Name |
---|
handle |
Name | Description |
---|---|
basic_format_arg [constructor] | Constructors |
format_custom | |
type | |
visit | Visits an argument dispatching to the appropriate visit method based on the argument type. For example, if the argument type is double then vis(value) will be called with the value of type double . |
operator bool | Conversion to bool |
Name | Description |
---|---|
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 : |
<fmt/base.h>
class handle;
Name | Description |
---|---|
handle [constructor] | Construct from custom_value |
format |
Construct from custom_value
<fmt/base.h>
explicit
handle(/* implementation-defined */ custom);
Name | Description |
---|---|
custom | The object to construct from |
<fmt/base.h>
void
format(
parse_context<char_type>& parse_ctx,
Context& ctx) const;
Constructors
<fmt/base.h>
Default constructor
constexpr
basic_format_arg();
» more...
Construct from T
template<typename T>
basic_format_arg(T&& val);
» more...
basic_format_arg(
/* implementation-defined */ const* args,
size_t size);
» more...
Default constructor
<fmt/base.h>
constexpr
basic_format_arg();
Construct from T
<fmt/base.h>
template<typename T>
basic_format_arg(T&& val);
Name | Description |
---|---|
val | The object to move construct from |
<fmt/base.h>
basic_format_arg(
/* implementation-defined */ const* args,
size_t size);
<fmt/base.h>
bool
format_custom(
char_type const* parse_begin,
parse_context<char_type>& parse_ctx,
Context& ctx);
<fmt/base.h>
/* implementation-defined */
type() const;
Visits an argument dispatching to the appropriate visit method based on the argument type. For example, if the argument type is double
then vis(value)
will be called with the value of type double
.
<fmt/base.h>
template<typename Visitor>
[[always_inline]]
constexpr
decltype(vis(0))
visit(Visitor&& vis) const;
Conversion to bool
<fmt/base.h>
constexpr
explicit
operator bool() const noexcept;
bool
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
:
<fmt/base.h>
template<typename Context>
class basic_format_args;
Name |
---|
format_arg |
Name | Description |
---|---|
basic_format_args [constructor] | Constructors |
get | Returns the argument with the specified id. |
get_id | |
max_size |
Name |
---|
args_ [variant member] |
values_ [variant member] |
void vlog(fmt::string_view fmt, fmt::format_args args); // OK fmt::format_args args = fmt::make_format_args(); // Dangling reference
Constructors
<fmt/base.h>
Default constructor
constexpr
basic_format_args();
» more...
Constructs a basic_format_args
object from format_arg_store
.
template<
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC>
[[always_inline]]
constexpr
basic_format_args(store<NUM_ARGS, NUM_NAMED_ARGS, DESC> const& s);
» more...
Construct from store
template<
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC>
constexpr
basic_format_args(store<NUM_ARGS, NUM_NAMED_ARGS, DESC> const& s);
» more...
Constructs a basic_format_args
object from a dynamic list of arguments.
constexpr
basic_format_args(
format_arg const* args,
int count,
bool has_named = false);
» more...
Default constructor
<fmt/base.h>
constexpr
basic_format_args();
Constructs a basic_format_args
object from format_arg_store
.
<fmt/base.h>
template<
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC>
[[always_inline]]
constexpr
basic_format_args(store<NUM_ARGS, NUM_NAMED_ARGS, DESC> const& s);
Name | Description |
---|---|
s | The object to copy construct from |
Construct from store
<fmt/base.h>
template<
int NUM_ARGS,
int NUM_NAMED_ARGS,
unsigned long long DESC>
constexpr
basic_format_args(store<NUM_ARGS, NUM_NAMED_ARGS, DESC> const& s);
Name | Description |
---|---|
s | The object to copy construct from |
Constructs a basic_format_args
object from a dynamic list of arguments.
<fmt/base.h>
constexpr
basic_format_args(
format_arg const* args,
int count,
bool has_named = false);
Name | Description |
---|---|
args | The object to construct from |
Returns the argument with the specified id.
<fmt/base.h>
Returns the argument with the specified id.
constexpr
format_arg
get(int id) const;
» more...
template<typename Char>
format_arg
get(basic_string_view<Char> name) const;
» more...
Returns the argument with the specified id.
<fmt/base.h>
template<typename Char>
format_arg
get(basic_string_view<Char> name) const;
<fmt/base.h>
template<typename Char>
constexpr
int
get_id(basic_string_view<Char> name) const;
<fmt/base.h>
int
max_size() const;
<fmt/base.h>
/* implementation-defined */ const* values_;
<fmt/xchar.h>
template<
typename Char,
typename... T>
struct basic_fstring;
Name |
---|
t |
Name | Description |
---|---|
basic_fstring [constructor] | Constructors |
get | |
operator basic_string_view<Char> | Conversion to basic_string_view |
Constructors
<fmt/xchar.h>
Construct from runtime_format_string
basic_fstring(runtime_format_string<Char> fmt);
» more...
Construct from S
template<typename S>
[[always_inline]]
basic_fstring(S const& value);
» more...
Construct from S
template<typename S>
[[always_inline]]
consteval
basic_fstring(S const& s);
» more...
Construct from runtime_format_string
Name | Description |
---|---|
fmt | The object to construct from |
Construct from S
<fmt/xchar.h>
template<typename S>
[[always_inline]]
basic_fstring(S const& value);
Name | Description |
---|---|
value | The object to copy construct from |
Construct from S
<fmt/xchar.h>
template<typename S>
[[always_inline]]
consteval
basic_fstring(S const& s);
Name | Description |
---|---|
s | The object to copy construct from |
Conversion to basic_string_view
std::basic_string_view
for pre-C++17. It provides a subset of the API. fmt::basic_string_view
is used for format strings 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).
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
.
<fmt/format.h>
template<
typename T,
size_t SIZE = inline_buffer_size,
typename Allocator = /* implementation-defined */>
class basic_memory_buffer
: public /* implementation-defined */
Name | Description |
---|---|
/* implementation-defined */ | A contiguous memory buffer with an optional growing ability. It is an internal class and shouldn't be used directly, only via memory_buffer . |
Name |
---|
const_reference |
value_type |
Name | Description |
---|---|
basic_memory_buffer [constructor] | Constructs a basic_memory_buffer object moving the content of the other object to it. |
~basic_memory_buffer [destructor] | Destructor |
operator= | Moves the content of the other basic_memory_buffer object to this one. |
append | |
get_allocator | |
reserve | Increases the buffer capacity to new_capacity . |
resize | Resizes the buffer to contain count elements. If T is a POD type new elements may not be initialized. |
Example:
auto out = fmt::memory_buffer(); fmt::format_to(std::back_inserter(out), "The answer is {}.", 42);
This will append "The answer is 42." to out
. The buffer content can be converted to std::string
with to_string(out)
.
<fmt/format.h>
using const_reference = T const&;
<fmt/format.h>
using value_type = T;
Constructs a basic_memory_buffer
object moving the content of the other object to it.
<fmt/format.h>
Constructs a basic_memory_buffer
object moving the content of the other object to it.
constexpr
basic_memory_buffer(basic_memory_buffer&& other) noexcept;
» more...
Construct from Allocator
constexpr
explicit
basic_memory_buffer(Allocator const& alloc = Allocator());
» more...
Constructs a basic_memory_buffer
object moving the content of the other object to it.
<fmt/format.h>
constexpr
basic_memory_buffer(basic_memory_buffer&& other) noexcept;
Name | Description |
---|---|
other | The object to move construct from |
Construct from Allocator
<fmt/format.h>
constexpr
explicit
basic_memory_buffer(Allocator const& alloc = Allocator());
Name | Description |
---|---|
alloc | The object to copy construct from |
Destructor
<fmt/format.h>
constexpr
~basic_memory_buffer();
Moves the content of the other basic_memory_buffer
object to this one.
<fmt/format.h>
basic_memory_buffer&
operator=(basic_memory_buffer&& other) noexcept;
Name | Description |
---|---|
other | The object to move assign from |
<fmt/format.h>
template<typename ContiguousRange>
constexpr
void
append(ContiguousRange const& range);
<fmt/format.h>
Allocator
get_allocator() const;
Increases the buffer capacity to new_capacity
.
<fmt/format.h>
void
reserve(size_t new_capacity);
Resizes the buffer to contain count
elements. If T is a POD type new elements may not be initialized.
<fmt/format.h>
constexpr
void
resize(size_t count);
<fmt/ostream.h>
template<typename Char>
struct basic_ostream_formatter
: formatter<basic_string_view<Char>, Char>
Name | Description |
---|---|
formatter<basic_string_view<Char>, Char> |
Name |
---|
format |
set_debug_format [deleted] |
<fmt/ostream.h>
template<
typename T,
typename Context>
decltype(ctx.out())
format(
T const& value,
Context& ctx) const;
<fmt/ostream.h>
void
set_debug_format() = delete;
<fmt/printf.h>
template<typename Char>
class basic_printf_context;
Name |
---|
char_type |
Name |
---|
Unnamed enum |
Name | Description |
---|---|
basic_printf_context [constructor] | Constructs a printf_context object. References to the arguments are stored in the context object so make sure they have appropriate lifetimes. |
advance_to | |
arg | |
locale | |
out |
<fmt/printf.h>
using char_type = Char;
<fmt/printf.h>
enum Unnamed enum;
Name |
---|
builtin_types |
Constructs a printf_context
object. References to the arguments are stored in the context object so make sure they have appropriate lifetimes.
<fmt/printf.h>
basic_printf_context(
basic_appender<Char> out,
basic_format_args<basic_printf_context> args);
Name | Description |
---|---|
out | The object to construct from |
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 : |
<fmt/base.h>
class basic_specs;
Name | Description |
---|---|
format_specs
|
<fmt/base.h>
constexpr
bool
alt() const;
<fmt/base.h>
constexpr
void
clear_alt();
<fmt/base.h>
constexpr
bool
dynamic() const;
<fmt/base.h>
template<typename Char>
constexpr
Char const*
fill() const;
» more...
template<typename Char>
constexpr
Char const*
fill() const;
» more...
<fmt/base.h>
template<typename Char>
constexpr
Char const*
fill() const;
<fmt/base.h>
template<typename Char>
constexpr
Char const*
fill() const;
<fmt/base.h>
constexpr
size_t
fill_size() const;
<fmt/base.h>
template<typename Char>
constexpr
Char
fill_unit() const;
<fmt/base.h>
constexpr
bool
localized() const;
<fmt/base.h>
constexpr
void
set_alt();
<fmt/base.h>
constexpr
void
set_fill(char c);
» more...
template<typename Char>
constexpr
void
set_fill(basic_string_view<Char> s);
» more...
<fmt/base.h>
constexpr
void
set_fill(char c);
<fmt/base.h>
template<typename Char>
constexpr
void
set_fill(basic_string_view<Char> s);
<fmt/base.h>
constexpr
void
set_localized();
<fmt/base.h>
constexpr
void
set_upper();
<fmt/base.h>
constexpr
bool
upper() const;
An implementation of std::basic_string_view
for pre-C++17. It provides a subset of the API. fmt::basic_string_view
is used for format strings 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).
<fmt/base.h>
template<typename Char>
class basic_string_view;
Name |
---|
iterator |
value_type |
Name | Description |
---|---|
basic_string_view [constructor] | Constructors |
begin | |
compare | |
data | Returns a pointer to the string data. |
end | |
operator[] | |
remove_prefix | |
size | Returns the string size. |
starts_with |
Name | Description |
---|---|
operator>= |
Greater-than-or-equal operator |
operator> |
Greater-than operator |
operator<= |
Less-than-or-equal operator |
operator< |
Less-than operator |
operator!= |
Inequality operator |
operator== |
Equality operator |
<fmt/base.h>
using iterator = Char const*;
<fmt/base.h>
using value_type = Char;
Constructors
<fmt/base.h>
Default constructor
constexpr
basic_string_view() noexcept;
» more...
Construct from nullptr_t
constexpr
basic_string_view(nullptr_t value) = delete;
» more...
Construct from Char
constexpr
basic_string_view(Char const* s);
» more...
Constructs a string view from a std::basic_string
or a std::basic_string_view
object.
template<typename S>
constexpr
basic_string_view(S const& s) noexcept;
» more...
Constructs a string view object from a C string and a size.
constexpr
basic_string_view(
Char const* s,
size_t count) noexcept;
» more...
Default constructor
<fmt/base.h>
constexpr
basic_string_view() noexcept;
Construct from nullptr_t
Name | Description |
---|---|
value | The object to construct from |
Construct from Char
<fmt/base.h>
constexpr
basic_string_view(Char const* s);
Name | Description |
---|---|
s | The object to construct from |
Constructs a string view from a std::basic_string
or a std::basic_string_view
object.
<fmt/base.h>
template<typename S>
constexpr
basic_string_view(S const& s) noexcept;
Name | Description |
---|---|
s | The object to copy construct from |
Constructs a string view object from a C string and a size.
<fmt/base.h>
constexpr
basic_string_view(
Char const* s,
size_t count) noexcept;
Name | Description |
---|---|
s | The object to construct from |
Returns a pointer to the string data.
<fmt/base.h>
constexpr
Char const*
data() const noexcept;
<fmt/base.h>
constexpr
Char const&
operator[](size_t pos) const noexcept;
<fmt/base.h>
constexpr
void
remove_prefix(size_t n) noexcept;
Returns the string size.
<fmt/base.h>
constexpr
size_t
size() const noexcept;
<fmt/base.h>
constexpr
bool
starts_with(Char c) const noexcept;
» more...
constexpr
bool
starts_with(basic_string_view<Char> sv) const noexcept;
» more...
constexpr
bool
starts_with(Char const* s) const;
» more...
<fmt/base.h>
constexpr
bool
starts_with(Char c) const noexcept;
<fmt/base.h>
constexpr
bool
starts_with(basic_string_view<Char> sv) const noexcept;
<fmt/base.h>
constexpr
bool
starts_with(Char const* s) const;
<fmt/os.h>
class buffered_file;
Name | Description |
---|---|
buffered_file [constructor] | Constructors |
~buffered_file [destructor] | Destructor |
operator= [deleted] | Assignment operators |
close | |
descriptor | |
get | |
print |
Name | Description |
---|---|
file |
Constructors
<fmt/os.h>
Default constructor
buffered_file() noexcept;
» more...
Copy constructor
buffered_file(buffered_file const& other) = delete;
» more...
Move constructor
buffered_file(buffered_file&& other) noexcept;
» more...
buffered_file(
cstring_view filename,
cstring_view mode);
» more...
Default constructor
<fmt/os.h>
buffered_file() noexcept;
Copy constructor
Name | Description |
---|---|
other | The object to copy construct from |
Move constructor
Name | Description |
---|---|
other | The object to move construct from |
Destructor
<fmt/os.h>
~buffered_file() noexcept;
Assignment operators
<fmt/os.h>
void
operator=(buffered_file const& other) = delete;
» more...
Move assignment operator
buffered_file&
operator=(buffered_file&& other);
» more...
Move assignment operator
Name | Description |
---|---|
other | The object to move assign from |
<fmt/os.h>
void
close();
<fmt/os.h>
int
descriptor() const;
<fmt/os.h>
FILE*
get() const noexcept;
<fmt/os.h>
template<typename... T>
void
print(
string_view fmt,
T const...&... args);
<fmt/format.h>
struct bytes;
Name | Description |
---|---|
bytes [constructor] | Construct from string_view |
Name |
---|
data |
Construct from string_view
Name | Description |
---|---|
s | The object to construct from |
<fmt/compile.h>
class compiled_string;
<fmt/ranges.h>
template<typename...>
struct conjunction
: std::true_type
Name | Description |
---|---|
std::true_type |
Name | Description |
---|---|
P |
<fmt/ranges.h>
template<
typename P1,
typename... Pn>
struct conjunction<P1, Pn...>
: conditional_t<bool(P1::value), conjunction<Pn...>, P1>
Name | Description |
---|---|
conditional_t<bool(P1::value), conjunction<Pn...>, P1> |
<fmt/base.h>
class context;
Name |
---|
char_type |
format_arg |
iterator |
Name |
---|
Unnamed enum |
Name | Description |
---|---|
context [constructor] [deleted] | Constructs a context object. References to the arguments are stored in the object so make sure they have appropriate lifetimes. |
operator= [deleted] | |
advance_to | |
arg | |
arg_id | |
args | |
locale | |
out |
<fmt/base.h>
using char_type = char;
<fmt/base.h>
enum Unnamed enum;
Name |
---|
builtin_types |
Constructs a context
object. References to the arguments are stored in the object so make sure they have appropriate lifetimes.
<fmt/base.h>
Copy constructor
context(context const& other) = delete;
» more...
Move constructor
constexpr
context(context&& other) = default;
» more...
Constructs a context
object. References to the arguments are stored in the object so make sure they have appropriate lifetimes.
constexpr
context(
iterator out,
format_args args,
locale_ref loc = {});
» more...
Copy constructor
Name | Description |
---|---|
other | The object to copy construct from |
Move constructor
Name | Description |
---|---|
other | The object to move construct from |
Constructs a context
object. References to the arguments are stored in the object so make sure they have appropriate lifetimes.
<fmt/base.h>
constexpr
context(
iterator out,
format_args args,
locale_ref loc = {});
Name | Description |
---|---|
out | The object to construct from |
<fmt/base.h>
format_arg
arg(string_view name) const;
» more...
constexpr
format_arg
arg(int id) const;
» more...
<fmt/chrono.h>
class day;
Name | Description |
---|---|
day [constructor] | Constructors |
operator unsigned int | Conversion to unsigned int |
Constructors
<fmt/chrono.h>
Default constructor
constexpr
day() = default;
» more...
Construct from unsigned int
constexpr
explicit
day(unsigned int d) noexcept;
» more...
Default constructor
<fmt/chrono.h>
constexpr
day() = default;
Construct from unsigned int
<fmt/chrono.h>
constexpr
explicit
day(unsigned int d) noexcept;
Name | Description |
---|---|
d | The value to construct from |
Conversion to unsigned int
<fmt/chrono.h>
constexpr
explicit
operator unsigned int() const noexcept;
unsigned int
A dynamic list of formatting arguments with storage.
<fmt/args.h>
template<typename Context>
class dynamic_format_arg_store;
Name | Description |
---|---|
dynamic_format_arg_store [constructor] | Default constructor |
clear | Erase all elements from the store. |
push_back | push_back overloads |
reserve | Reserves space to store at least new_cap arguments including new_cap_named named arguments. |
size | Returns the number of elements in the store. |
operator basic_format_args<Context> | Conversion to basic_format_args |
Name | Description |
---|---|
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 : |
It can be implicitly converted into fmt::basic_format_args
for passing into type-erased formatting functions such as fmt::vformat
.
Default constructor
<fmt/args.h>
constexpr
dynamic_format_arg_store() = default;
Erase all elements from the store.
<fmt/args.h>
void
clear();
push_back
overloads
<fmt/args.h>
Adds a reference to the argument into the dynamic store for later passing to a formatting function.
template<typename T>
void
push_back(std::reference_wrapper<T> arg);
» more...
Adds an argument into the dynamic store for later passing to a formatting function.
template<typename T>
void
push_back(T const& arg);
» more...
Adds named argument into the dynamic store for later passing to a formatting function. std::reference_wrapper
is supported to avoid copying of the argument. The name is always copied into the store.
template<typename T>
void
push_back(/* implementation-defined */ const& arg);
» more...
Adds a reference to the argument into the dynamic store for later passing to a formatting function.
<fmt/args.h>
template<typename T>
void
push_back(std::reference_wrapper<T> arg);
Example:
fmt::dynamic_format_arg_store<fmt::format_context> store; char band[]= "Rolling Stones"; store.push_back(std::cref(band)); band[9]= 'c'; // Changing str affects the output. std::string result = fmt::vformat("{}", store); // result == "Rolling Scones"
Adds an argument into the dynamic store for later passing to a formatting function.
<fmt/args.h>
template<typename T>
void
push_back(T const& arg);
Note that custom types and string types (but not string views) are copied into the store dynamically allocating memory if necessary.
Example:
fmt::dynamic_format_arg_store<fmt::format_context> store; store.push_back(42); store.push_back("abc"); store.push_back(1.5f); std::string result = fmt::vformat("{} and {} and {}", store);
Adds named argument into the dynamic store for later passing to a formatting function. std::reference_wrapper
is supported to avoid copying of the argument. The name is always copied into the store.
<fmt/args.h>
template<typename T>
void
push_back(/* implementation-defined */ const& arg);
Reserves space to store at least new_cap
arguments including new_cap_named
named arguments.
<fmt/args.h>
void
reserve(
size_t new_cap,
size_t new_cap_named);
Returns the number of elements in the store.
<fmt/args.h>
size_t
size() const noexcept;
Conversion to basic_format_args
vformat
:
<fmt/os.h>
class file;
An error reported from a formatting function.
<fmt/format.h>
class format_error
: public std::runtime_error
Name | Description |
---|---|
std::runtime_error |
Name |
---|
operator= |
what [virtual] |
Name |
---|
format_error |
<stdexcept>
runtime_error&
operator=(runtime_error const& value) noexcept;
<stdexcept>
virtual
char const*
what() const noexcept override;
<fmt/format.h>
using std::runtime_error::format_error;
<fmt/format.h>
template<typename Locale>
class format_facet
: public Locale::facet
Name | Description |
---|---|
Locale::facet |
Name | Description |
---|---|
format_facet [constructor] | Construct from Locale |
format_facet [constructor] | |
put |
Name |
---|
id |
Name |
---|
do_put [virtual] |
Construct from Locale
<fmt/format.h>
explicit
format_facet(Locale& loc);
Name | Description |
---|---|
loc | The object to copy construct from |
<fmt/format.h>
explicit
format_facet(
string_view sep = "",
std::string grouping = "\3",
std::string decimal_point = ".");
<fmt/format.h>
bool
put(
appender out,
loc_value val,
format_specs const& specs) const;
<fmt/format.h>
static
Locale::id id;
<fmt/format.h>
virtual
bool
do_put(
appender out,
loc_value val,
format_specs const& specs) const;
Name | Description |
---|---|
locale::facet |
Name | Description |
---|---|
format_facet [constructor] | Constructors |
put |
Name |
---|
id |
Name |
---|
do_put [virtual] |
Constructors
<fmt/format.h>
Construct from locale
explicit
format_facet(locale& loc);
» more...
explicit
format_facet(
string_view sep = "",
std::string grouping = "\3",
std::string decimal_point = ".");
» more...
Construct from locale
<fmt/format.h>
explicit
format_facet(locale& loc);
Name | Description |
---|---|
loc | The object to copy construct from |
<fmt/format.h>
explicit
format_facet(
string_view sep = "",
std::string grouping = "\3",
std::string decimal_point = ".");
<fmt/format.h>
bool
put(
appender out,
loc_value val,
format_specs const& specs) const;
<fmt/format.h>
static
locale::id id;
<fmt/format.h>
virtual
bool
do_put(
appender out,
loc_value val,
format_specs const& specs) const;
A fast integer formatter.
<fmt/format.h>
class format_int;
Name | Description |
---|---|
format_int [constructor] | Constructors |
c_str | Returns a pointer to the output buffer content with terminating null character appended. |
data | Returns a pointer to the output buffer content. No terminating null character is appended. |
size | Returns the number of characters written to the output buffer. |
str | Returns the content of the output buffer as an std::string . |
Constructors
<fmt/format.h>
Construct from int
constexpr
explicit
format_int(int value);
» more...
Construct from unsigned int
constexpr
explicit
format_int(unsigned int value);
» more...
Construct from long
constexpr
explicit
format_int(long value);
» more...
Construct from unsigned long
constexpr
explicit
format_int(unsigned long value);
» more...
Construct from long long
constexpr
explicit
format_int(long long value);
» more...
Construct from unsigned long long
constexpr
explicit
format_int(unsigned long long value);
» more...
Construct from int
<fmt/format.h>
constexpr
explicit
format_int(int value);
Name | Description |
---|---|
value | The value to construct from |
Construct from unsigned int
<fmt/format.h>
constexpr
explicit
format_int(unsigned int value);
Name | Description |
---|---|
value | The value to construct from |
Construct from long
<fmt/format.h>
constexpr
explicit
format_int(long value);
Name | Description |
---|---|
value | The value to construct from |
Construct from unsigned long
<fmt/format.h>
constexpr
explicit
format_int(unsigned long value);
Name | Description |
---|---|
value | The value to construct from |
Construct from long long
<fmt/format.h>
constexpr
explicit
format_int(long long value);
Name | Description |
---|---|
value | The value to construct from |
Construct from unsigned long long
<fmt/format.h>
constexpr
explicit
format_int(unsigned long long value);
Name | Description |
---|---|
value | The value to construct from |
Returns a pointer to the output buffer content with terminating null character appended.
<fmt/format.h>
constexpr
char const*
c_str() const;
Returns a pointer to the output buffer content. No terminating null character is appended.
<fmt/format.h>
constexpr
char const*
data() const;
Returns the number of characters written to the output buffer.
<fmt/format.h>
constexpr
size_t
size() const;
Returns the content of the output buffer as an std::string
.
<fmt/format.h>
std::string
str() const;
std::string
.
Name | Description |
---|---|
basic_specs |
Name | Description |
---|---|
format_specs [constructor] | Default constructor |
align | |
alt | |
clear_alt | |
copy_fill_from | |
dynamic | |
dynamic_precision | |
dynamic_width | |
fill | |
fill_size | |
fill_unit | |
localized | |
set_align | |
set_alt | |
set_dynamic_precision | |
set_dynamic_width | |
set_fill | |
set_localized | |
set_sign | |
set_type | |
set_upper | |
sign | |
type | |
upper |
Name |
---|
precision |
width |
Default constructor
<fmt/base.h>
constexpr
format_specs();
<fmt/base.h>
int precision;
<fmt/base.h>
int width;
<fmt/base.h>
template<typename OutputIt>
struct format_to_n_result;
Name | Description |
---|---|
out | Iterator past the end of the output range. |
size | Total (not truncated) output size. |
Name | Description |
---|---|
format_to_n | Formats args according to specifications in fmt , writes up to n characters of the result to the output iterator out and returns the total (not truncated) output size and the iterator past the end of the output range. format_to_n does not append a terminating null character. |
Iterator past the end of the output range.
<fmt/base.h>
OutputIt out;
Total (not truncated) output size.
<fmt/base.h>
size_t size;
<fmt/base.h>
struct format_to_result;
Name | Description |
---|---|
operator char* | Conversion to char |
Name | Description |
---|---|
out | Pointer to just after the last successful write in the array. |
truncated | Specifies if the output was truncated. |
Conversion to char
<fmt/base.h>
constexpr
operator char*() const;
char
Pointer to just after the last successful write in the array.
<fmt/base.h>
char* out;
Specifies if the output was truncated.
<fmt/base.h>
bool truncated;
<fmt/base.h>
template<
typename T,
typename Char = char,
typename Enable = void>
struct formatter;
Name | Description |
---|---|
formatter [constructor] [deleted] | Default constructor |
Default constructor
<fmt/base.h>
formatter() = delete;
Name |
---|
format |
parse |
<fmt/format-inl.h>
format_context::iterator
format(
/* implementation-defined */ const& n,
format_context& ctx) const;
<fmt/format-inl.h>
constexpr
format_parse_context::iterator
parse(format_parse_context& ctx);
Name |
---|
format |
parse |
<fmt/format.h>
template<typename FormatContext>
decltype(ctx.out())
format(
bytes b,
FormatContext& ctx) const;
Name |
---|
format |
parse |
<fmt/std.h>
template<typename FormatContext>
constexpr
decltype(ctx.out())
format(
std::error_code const& ec,
FormatContext& ctx) const;
Name |
---|
format |
parse |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::source_location const& loc,
FormatContext& ctx) const;
Name |
---|
format |
parse |
<fmt/std.h>
template<typename Context>
decltype(ctx.out())
format(
std::type_info const& ti,
Context& ctx) const;
<fmt/format.h>
template<typename T>
struct formatter<group_digits_view<T>>
: formatter<T>
Name | Description |
---|---|
formatter<T> |
Name |
---|
format |
parse |
<fmt/format.h>
template<typename FormatContext>
decltype(ctx.out())
format(
group_digits_view<T> view,
FormatContext& ctx) const;
<fmt/std.h>
template<typename T>
requires std::is_base_of<std::exception, T>::value
struct formatter<T, char>;
Name |
---|
format |
parse |
<fmt/std.h>
template<typename Context>
decltype(ctx.out())
format(
std::exception const& ex,
Context& ctx) const;
<fmt/std.h>
template<typename Char>
struct formatter<std::atomic_flag, Char>
: formatter<bool, Char>
Name | Description |
---|---|
formatter<bool, Char> |
Name |
---|
format |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::atomic_flag const& v,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<std::byte, Char>
: formatter<unsigned int, Char>
Name | Description |
---|---|
formatter<unsigned int, Char> |
Name |
---|
format |
Name |
---|
format_as |
<fmt/format.h>
template<typename Context>
decltype(ctx.out())
format(
std::byte b,
Context& ctx) const;
<fmt/format.h>
static
unsigned char
format_as(std::byte b);
Name |
---|
format |
parse |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
day d,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter</* implementation-defined */, Char>
: /* implementation-defined */
Name | Description |
---|---|
/* implementation-defined */ |
<fmt/std.h>
template<typename Char>
struct formatter<std::thread::id, Char>
: basic_ostream_formatter<Char>
Name | Description |
---|---|
basic_ostream_formatter<Char> |
Name |
---|
format |
parse |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::monostate const&,
FormatContext& ctx) const;
Name |
---|
format |
parse |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
month m,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<std::nullptr_t, Char>
: formatter<void const*, Char>
Name | Description |
---|---|
formatter<void const*, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
std::nullptr_t value,
FormatContext& ctx) const;
<fmt/std.h>
template<typename Char>
struct formatter<std::filesystem::path, Char>;
Name |
---|
format |
parse |
set_debug_format |
<fmt/std.h>
template<typename FormatContext>
auto
format(
std::filesystem::path const& p,
FormatContext& ctx) const;
<fmt/std.h>
constexpr
void
set_debug_format(bool set = true);
Name |
---|
format |
parse |
Name |
---|
do_format |
do_parse |
localized |
set_localized |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
tm const& tm,
FormatContext& ctx) const;
<fmt/chrono.h>
template<
typename Duration,
typename FormatContext>
decltype(ctx.out())
do_format(
tm const& tm,
FormatContext& ctx,
Duration const* subsecs) const;
<fmt/chrono.h>
constexpr
Char const*
do_parse(
parse_context<Char>& ctx,
bool has_timezone);
<fmt/chrono.h>
bool
localized() const;
<fmt/chrono.h>
constexpr
void
set_localized();
Name |
---|
format |
parse |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
weekday wd,
FormatContext& ctx) const;
Name |
---|
format |
parse |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
year y,
FormatContext& ctx) const;
Name |
---|
format |
parse |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
year_month_day val,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter</* implementation-defined */, Char>
: formatter<basic_string_view<Char>, Char>
Name | Description |
---|---|
formatter<basic_string_view<Char>, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
/* implementation-defined */ value,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<signed char, Char>
: formatter<int, Char>
Name | Description |
---|---|
formatter<int, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
signed char value,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<unsigned char, Char>
: formatter<unsigned int, Char>
Name | Description |
---|---|
formatter<unsigned int, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
unsigned char value,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<short, Char>
: formatter<int, Char>
Name | Description |
---|---|
formatter<int, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
short value,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<unsigned short, Char>
: formatter<unsigned int, Char>
Name | Description |
---|---|
formatter<unsigned int, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
unsigned short value,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<long, Char>
: formatter</* implementation-defined */, Char>
Name | Description |
---|---|
formatter</* implementation-defined */, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
long value,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<unsigned long, Char>
: formatter</* implementation-defined */, Char>
Name | Description |
---|---|
formatter</* implementation-defined */, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
unsigned long value,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<Char*, Char>
: formatter<Char const*, Char>
Name | Description |
---|---|
formatter<Char const*, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
Char* value,
FormatContext& ctx) const;
<fmt/format.h>
template<typename Char>
struct formatter<void*, Char>
: formatter<void const*, Char>
Name | Description |
---|---|
formatter<void const*, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype()
format(
void* value,
FormatContext& ctx) const;
<fmt/std.h>
template<
typename BitRef,
typename Char>
requires detail::is_bit_reference_like<BitRef>::value
struct formatter<BitRef, Char>
: formatter<bool, Char>
Name | Description |
---|---|
formatter<bool, Char> |
Name |
---|
format |
<fmt/std.h>
template<typename FormatContext>
constexpr
decltype(ctx.out())
format(
BitRef const& v,
FormatContext& ctx) const;
<fmt/ranges.h>
template<
typename R,
typename Char>
requires conjunction<
bool_constant<
range_format_kind<R, Char>::value != range_format::disabled &&
range_format_kind<R, Char>::value != range_format::map &&
range_format_kind<R, Char>::value != range_format::string &&
range_format_kind<R, Char>::value != range_format::debug_string>,
detail::is_formattable_delayed<R, Char>>::value
struct formatter<R, Char>;
Name |
---|
nonlocking |
Name | Description |
---|---|
formatter [constructor] | Default constructor |
format | |
parse |
<fmt/ranges.h>
using nonlocking = void;
Default constructor
<fmt/ranges.h>
constexpr
formatter();
<fmt/ranges.h>
template<typename FormatContext>
decltype(ctx.out())
format(
range_type& range,
FormatContext& ctx) const;
<fmt/ranges.h>
template<
typename R,
typename Char>
requires conjunction<
bool_constant<range_format_kind<R, Char>::value == range_format::map>,
detail::is_formattable_delayed<R, Char>>::value
struct formatter<R, Char>;
Name | Description |
---|---|
formatter [constructor] | Default constructor |
format | |
parse |
Default constructor
<fmt/ranges.h>
constexpr
formatter();
<fmt/ranges.h>
template<typename FormatContext>
decltype(ctx.out())
format(
map_type& map,
FormatContext& ctx) const;
<fmt/ranges.h>
template<
typename R,
typename Char>
requires range_format_kind<R, Char>::value == range_format::string ||
range_format_kind<R, Char>::value ==
range_format::debug_string
struct formatter<R, Char>;
Name |
---|
format |
parse |
<fmt/ranges.h>
template<typename FormatContext>
decltype(ctx.out())
format(
range_type& range,
FormatContext& ctx) const;
<fmt/base.h>
template<
typename T,
typename Char>
requires detail::type_constant<T, Char>::value !=
detail::type::custom_type
struct formatter<T, Char>
: /* implementation-defined */
Name | Description |
---|---|
/* implementation-defined */ |
<fmt/ranges.h>
template<
typename T,
typename Char>
requires conjunction<detail::is_container_adaptor_like<T>,
bool_constant<range_format_kind<T, Char>::value ==
range_format::disabled>>::value
struct formatter<T, Char>
: formatter</* implementation-defined */, Char>
Name | Description |
---|---|
formatter</* implementation-defined */, Char> |
Name |
---|
all |
Name |
---|
format |
<fmt/ranges.h>
using all = /* implementation-defined */;
<fmt/ranges.h>
template<typename FormatContext>
decltype(ctx.out())
format(
T const& value,
FormatContext& ctx) const;
<fmt/ranges.h>
template<
typename Tuple,
typename Char>
requires fmt::is_tuple_like<Tuple>::value &&
fmt::is_tuple_formattable<Tuple, Char>::value
struct formatter<Tuple, Char>;
Name | Description |
---|---|
formatter [constructor] | Default constructor |
format | |
parse | |
set_brackets | |
set_separator |
Default constructor
<fmt/ranges.h>
constexpr
formatter();
<fmt/ranges.h>
template<typename FormatContext>
decltype(ctx.out())
format(
Tuple const& value,
FormatContext& ctx) const;
<fmt/ranges.h>
constexpr
void
set_brackets(
basic_string_view<Char> open,
basic_string_view<Char> close);
<fmt/std.h>
template<
typename Variant,
typename Char>
requires std::conjunction_v<
is_variant_like<Variant>,
detail::is_variant_formattable<Variant, Char>>
struct formatter<Variant, Char>;
Name |
---|
format |
parse |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
Variant const& value,
FormatContext& ctx) const;
<fmt/std.h>
template<
typename T,
typename Char>
requires is_formattable<T, Char>::value
struct formatter<std::atomic<T>, Char>
: formatter<T, Char>
Name | Description |
---|---|
formatter<T, Char> |
Name |
---|
format |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::atomic<T> const& v,
FormatContext& ctx) const;
<fmt/std.h>
template<
size_t N,
typename Char>
struct formatter<std::bitset<N>, Char>
: nested_formatter<basic_string_view<Char>, Char>
Name | Description |
---|---|
nested_formatter<basic_string_view<Char>, Char> |
Name |
---|
format |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::bitset<N> const& bs,
FormatContext& ctx) const;
<fmt/std.h>
template<
typename T,
typename Char>
struct formatter<std::complex<T>, Char>;
Name |
---|
format |
parse |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::complex<T> const& c,
FormatContext& ctx) const;
<fmt/chrono.h>
template<
typename Duration,
typename Char>
struct formatter<local_time<Duration>, Char>;
Name |
---|
format |
parse |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
local_time<Duration> val,
FormatContext& ctx) const;
<fmt/format.h>
template<
typename T,
typename Char>
struct formatter<nested_view<T, Char>, Char>;
Name |
---|
format |
parse |
<fmt/format.h>
template<typename FormatContext>
decltype(ctx.out())
format(
nested_view<T, Char> view,
FormatContext& ctx) const;
<fmt/std.h>
template<
typename T,
typename Char>
requires is_formattable<T, Char>::value
struct formatter<std::optional<T>, Char>;
Name |
---|
format |
parse |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::optional<T> const& opt,
FormatContext& ctx) const;
<fmt/std.h>
template<
typename T,
typename Char>
requires is_formattable<remove_cvref_t<T>, Char>::value &&
!detail::has_format_as<T>::value &&
!detail::has_format_as_member<T>::value
struct formatter<std::reference_wrapper<T>, Char>
: formatter<remove_cvref_t<T>, Char>
Name | Description |
---|---|
formatter<remove_cvref_t<T>, Char> |
Name |
---|
format |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::reference_wrapper<T> ref,
FormatContext& ctx) const;
<fmt/ostream.h>
template<
typename T,
typename Char>
struct formatter</* implementation-defined */, Char>
: basic_ostream_formatter<Char>
Name | Description |
---|---|
basic_ostream_formatter<Char> |
Name |
---|
format |
<fmt/ostream.h>
template<typename Context>
decltype(ctx.out())
format(
/* implementation-defined */ view,
Context& ctx) const;
<fmt/color.h>
template<
typename T,
typename Char>
struct formatter</* implementation-defined */, Char>
: formatter<T, Char>
Name | Description |
---|---|
formatter<T, Char> |
Name |
---|
format |
<fmt/color.h>
template<typename FormatContext>
decltype(ctx.out())
format(
/* implementation-defined */ const& arg,
FormatContext& ctx) const;
<fmt/chrono.h>
template<
typename Char,
typename Duration>
struct formatter<sys_time<Duration>, Char>;
Name |
---|
format |
parse |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
sys_time<Duration> val,
FormatContext& ctx) const;
<fmt/ranges.h>
template<
typename Tuple,
typename Char>
requires is_tuple_like<Tuple>::value
struct formatter<tuple_join_view<Tuple, Char>, Char>;
Name |
---|
format |
parse |
<fmt/ranges.h>
template<typename FormatContext>
FormatContext::iterator
format(
tuple_join_view<Tuple, Char> const& value,
FormatContext& ctx) const;
<fmt/format.h>
template<
int N,
typename Char>
struct formatter</* implementation-defined */, Char>
: formatter<long long, Char>
Name | Description |
---|---|
formatter<long long, Char> |
<fmt/chrono.h>
template<
typename Duration,
typename Char>
struct formatter<utc_time<Duration>, Char>
: formatter<sys_time<Duration>, Char>
Name | Description |
---|---|
formatter<sys_time<Duration>, Char> |
Name |
---|
format |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
utc_time<Duration> val,
FormatContext& ctx) const;
<fmt/format.h>
template<
typename Char,
size_t N>
struct formatter<Char[], Char>
: formatter<basic_string_view<Char>, Char>
Name | Description |
---|---|
formatter<basic_string_view<Char>, Char> |
<fmt/format.h>
template<
typename Char,
typename Traits,
typename Allocator>
class formatter<std::basic_string<Char, Traits, Allocator>, Char>
: public formatter<basic_string_view<Char>, Char>
Name | Description |
---|---|
formatter<basic_string_view<Char>, Char> |
<fmt/chrono.h>
template<
typename Rep,
typename Period,
typename Char>
struct formatter<std::chrono::duration<Rep, Period>, Char>;
Name |
---|
format |
parse |
<fmt/chrono.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::chrono::duration<Rep, Period> d,
FormatContext& ctx) const;
<fmt/std.h>
template<
typename T,
typename E,
typename Char>
requires (std::is_void<T>::value ||
is_formattable<T, Char>::value) &&
is_formattable<E, Char>::value
struct formatter<std::expected<T, E>, Char>;
Name |
---|
format |
parse |
<fmt/std.h>
template<typename FormatContext>
decltype(ctx.out())
format(
std::expected<T, E> const& value,
FormatContext& ctx) const;
<fmt/ranges.h>
template<
typename It,
typename Sentinel,
typename Char>
struct formatter<join_view<It, Sentinel, Char>, Char>;
Name |
---|
nonlocking |
Name |
---|
format |
parse |
<fmt/ranges.h>
using nonlocking = void;
<fmt/ranges.h>
template<typename FormatContext>
decltype(ctx.out())
format(
view& value,
FormatContext& ctx) const;
<fmt/format.h>
template<
typename T,
typename Char>
struct formatter<T, Char, void_t</* implementation-defined */>>
: formatter</* implementation-defined */, Char>
Name | Description |
---|---|
formatter</* implementation-defined */, Char> |
Name |
---|
format |
<fmt/format.h>
template<typename FormatContext>
constexpr
decltype(ctx.out())
format(
T const& value,
FormatContext& ctx) const;
A compile-time format string. Use format_string
in the public API to prevent type deduction.
<fmt/base.h>
template<typename... T>
struct fstring;
Name |
---|
t |
Name | Description |
---|---|
fstring [constructor] | Constructors |
get | |
operator string_view const& | Conversion to string_view |
Name |
---|
str |
Constructors
<fmt/base.h>
Construct from runtime_format_string
fstring(runtime_format_string fmt);
» more...
Construct from S
template<typename S>
[[always_inline]]
fstring(S const& value);
» more...
Construct from S
template<typename S>
[[always_inline]]
consteval
fstring(S const& s);
» more...
Construct from char
template<size_t N>
[[always_inline]]
consteval
fstring(char const(& s)[]);
» more...
Construct from runtime_format_string
Name | Description |
---|---|
fmt | The object to construct from |
Construct from S
<fmt/base.h>
template<typename S>
[[always_inline]]
fstring(S const& value);
Name | Description |
---|---|
value | The object to copy construct from |
Construct from S
<fmt/base.h>
template<typename S>
[[always_inline]]
consteval
fstring(S const& s);
Name | Description |
---|---|
s | The object to copy construct from |
Construct from char
<fmt/base.h>
template<size_t N>
[[always_inline]]
consteval
fstring(char const(& s)[]);
Name | Description |
---|---|
s | The value to construct from |
Conversion to string_view
string_view
<fmt/format.h>
template<
typename OutputIt,
typename Char>
class generic_context;
Name |
---|
char_type |
iterator |
Name |
---|
Unnamed enum |
Name | Description |
---|---|
generic_context [constructor] [deleted] | Constructors |
operator= [deleted] | |
advance_to | |
arg | |
arg_id | |
locale | |
out |
<fmt/format.h>
using char_type = Char;
<fmt/format.h>
using iterator = OutputIt;
<fmt/format.h>
enum Unnamed enum;
Name |
---|
builtin_types |
Constructors
<fmt/format.h>
Copy constructor
generic_context(generic_context const& other) = delete;
» more...
Move constructor
generic_context(generic_context&& other) = default;
» more...
constexpr
generic_context(
OutputIt out,
basic_format_args<generic_context> args,
locale_ref loc = {});
» more...
Copy constructor
Name | Description |
---|---|
other | The object to copy construct from |
Move constructor
Name | Description |
---|---|
other | The object to move construct from |
<fmt/format.h>
constexpr
generic_context(
OutputIt out,
basic_format_args<generic_context> args,
locale_ref loc = {});
<fmt/format.h>
basic_format_arg<generic_context>
arg(basic_string_view<Char> name) const;
» more...
constexpr
basic_format_arg<generic_context>
arg(int id) const;
» more...
<fmt/format.h>
basic_format_arg<generic_context>
arg(basic_string_view<Char> name) const;
<fmt/format.h>
template<typename T>
struct group_digits_view;
Name |
---|
value |
Name | Description |
---|---|
group_digits | Returns a view that formats an integer value using ',' as a locale-independent thousands separator. |
<fmt/format.h>
T value;
<fmt/compile.h>
template<typename S>
struct is_compiled_string
: std::is_base_of<compiled_string, S>
Name | Description |
---|---|
std::is_base_of<compiled_string, S> |
<fmt/base.h>
template<typename T>
struct is_contiguous
: std::false_type
Name | Description |
---|---|
std::false_type |
<fmt/format.h>
template<
typename T,
size_t SIZE,
typename Allocator>
struct is_contiguous<basic_memory_buffer<T, SIZE, Allocator>>
: std::true_type
Name | Description |
---|---|
std::true_type |
<fmt/format.h>
template<
typename Char,
typename Traits,
typename Allocator>
struct is_contiguous<std::basic_string<Char, Traits, Allocator>>
: std::true_type
Name | Description |
---|---|
std::true_type |
<fmt/ranges.h>
template<
typename T,
typename Char>
struct is_range;
Name |
---|
value |
<fmt/ranges.h>
inline constexpr static
bool value = detail::is_range_<T>::value && !detail::has_to_string_view<T>::value;
<fmt/ranges.h>
template<
typename T,
typename C>
struct is_tuple_formattable;
Name |
---|
value |
<fmt/ranges.h>
inline constexpr static
bool value = detail::is_tuple_formattable_<T, C>::value;
<fmt/ranges.h>
template<typename T>
struct is_tuple_like;
Name |
---|
value |
<fmt/ranges.h>
inline constexpr static
bool value = detail::is_tuple_like_<T>::value && !detail::is_range_<T>::value;
<fmt/std.h>
template<typename T>
struct is_variant_like;
Name |
---|
value |
<fmt/std.h>
inline constexpr static
bool value = detail::is_variant_like_<T>::value;
<fmt/ranges.h>
template<
typename It,
typename Sentinel,
typename Char = char>
struct join_view
: /* implementation-defined */
Name | Description |
---|---|
/* implementation-defined */ |
Name |
---|
join_view [constructor] |
Name |
---|
begin |
end |
sep |
Name | Description |
---|---|
join | Returns a view that formats the iterator range [begin, end) with elements separated by sep . |
join | Returns a view that formats range with elements separated by sep . |
join | Returns an object that formats std::initializer_list with elements separated by sep . |
<fmt/ranges.h>
It begin;
<fmt/ranges.h>
Sentinel end;
<fmt/format.h>
class loc_value;
Name | Description |
---|---|
loc_value [constructor] | Constructors |
visit |
Constructors
<fmt/format.h>
Construct from T
template<typename T>
loc_value(T value);
» more...
Construct from T
template<typename T>
loc_value(T value);
» more...
Construct from T
<fmt/format.h>
template<typename T>
loc_value(T value);
Name | Description |
---|---|
value | The object to construct from |
Construct from T
<fmt/format.h>
template<typename T>
loc_value(T value);
Name | Description |
---|---|
value | The object to construct from |
<fmt/format.h>
template<typename Visitor>
decltype(vis(0))
visit(Visitor&& vis);
<fmt/base.h>
class locale_ref;
Name | Description |
---|---|
locale_ref [constructor] | Constructors |
get | |
operator bool | Conversion to bool |
Constructors
<fmt/base.h>
Default constructor
constexpr
locale_ref();
» more...
Construct from Locale
template<typename Locale>
requires (sizeof(Locale::collate) != 0)
locale_ref(Locale const& loc);
» more...
Default constructor
<fmt/base.h>
constexpr
locale_ref();
Construct from Locale
<fmt/base.h>
template<typename Locale>
requires (sizeof(Locale::collate) != 0)
locale_ref(Locale const& loc);
Name | Description |
---|---|
loc | The object to copy construct from |
<fmt/base.h>
template<typename Locale>
Locale
get() const;
Conversion to bool
<fmt/base.h>
explicit
operator bool() const noexcept;
bool
<fmt/base.h>
struct monostate;
Name | Description |
---|---|
monostate [constructor] | Default constructor |
Default constructor
<fmt/base.h>
constexpr
monostate();
<fmt/chrono.h>
class month;
Name | Description |
---|---|
month [constructor] | Constructors |
operator unsigned int | Conversion to unsigned int |
Constructors
<fmt/chrono.h>
Default constructor
constexpr
month() = default;
» more...
Construct from unsigned int
constexpr
explicit
month(unsigned int m) noexcept;
» more...
Default constructor
<fmt/chrono.h>
constexpr
month() = default;
Construct from unsigned int
<fmt/chrono.h>
constexpr
explicit
month(unsigned int m) noexcept;
Name | Description |
---|---|
m | The value to construct from |
Conversion to unsigned int
<fmt/chrono.h>
constexpr
explicit
operator unsigned int() const noexcept;
unsigned int
<fmt/format.h>
template<
typename T,
typename Char = char>
struct nested_formatter;
Name | Description |
---|---|
nested_formatter [constructor] | Default constructor |
nested | |
parse | |
write_padded |
Name | Description |
---|---|
formatter
|
Default constructor
<fmt/format.h>
constexpr
nested_formatter();
<fmt/format.h>
template<
typename FormatContext,
typename F>
decltype(ctx.out())
write_padded(
FormatContext& ctx,
F write) const;
<fmt/format.h>
template<
typename T,
typename Char>
struct nested_view;
Name |
---|
fmt |
value |
<fmt/format.h>
T const* value;
Parsing context consisting of a format string range being parsed and an argument counter for automatic indexing.
<fmt/base.h>
template<typename Char = char>
class parse_context;
Name |
---|
char_type |
iterator |
Name | Description |
---|---|
parse_context [constructor] | |
advance_to | Advances the begin iterator to it . |
begin | Returns an iterator to the beginning of the format string range being parsed. |
check_arg_id | Reports an error if using the automatic argument indexing; otherwise switches to the manual indexing. |
check_dynamic_spec | |
end | Returns an iterator past the end of the format string range being parsed. |
next_arg_id | Reports an error if using the manual argument indexing; otherwise returns the next argument index and switches to the automatic indexing. |
<fmt/base.h>
using char_type = Char;
<fmt/base.h>
using iterator = Char const*;
<fmt/base.h>
constexpr
explicit
parse_context(
basic_string_view<Char> fmt,
int next_arg_id = 0);
Advances the begin iterator to it
.
Returns an iterator to the beginning of the format string range being parsed.
Reports an error if using the automatic argument indexing; otherwise switches to the manual indexing.
<fmt/base.h>
constexpr
void
check_arg_id(basic_string_view<Char>);
» more...
Reports an error if using the automatic argument indexing; otherwise switches to the manual indexing.
constexpr
void
check_arg_id(int id);
» more...
Reports an error if using the automatic argument indexing; otherwise switches to the manual indexing.
<fmt/base.h>
constexpr
void
check_arg_id(int id);
<fmt/base.h>
constexpr
void
check_dynamic_spec(int arg_id);
Returns an iterator past the end of the format string range being parsed.
Reports an error if using the manual argument indexing; otherwise returns the next argument index and switches to the automatic indexing.
<fmt/base.h>
constexpr
int
next_arg_id();
Name |
---|
char_type |
iterator |
Name |
---|
parse_context [constructor] |
advance_to |
begin |
check_arg_id |
check_dynamic_spec |
end |
next_arg_id |
<fmt/base.h>
using char_type = char;
<fmt/base.h>
using iterator = char const*;
<fmt/base.h>
constexpr
explicit
parse_context(
basic_string_view<char> fmt,
int next_arg_id = 0);
<fmt/base.h>
constexpr
void
check_arg_id(basic_string_view<char>);
» more...
constexpr
void
check_arg_id(int id);
» more...
<fmt/base.h>
constexpr
void
check_arg_id(int id);
<fmt/base.h>
constexpr
void
check_dynamic_spec(int arg_id);
<fmt/base.h>
constexpr
int
next_arg_id();
<fmt/std.h>
class path
: public std::filesystem::path
Name | Description |
---|---|
std::filesystem::path |
Name |
---|
display_string |
generic_display_string |
generic_system_string |
system_string |
<fmt/std.h>
std::string
display_string() const;
<fmt/std.h>
std::string
generic_display_string() const;
<fmt/std.h>
std::string
generic_system_string() const;
<fmt/std.h>
std::string
system_string() const;
<fmt/ranges.h>
template<
typename T,
typename Char,
typename Enable = void>
struct range_format_kind
: conditional_t<is_range<T, Char>::value, /* implementation-defined */, std::integral_constant<range_format, range_format::disabled>>
Name | Description |
---|---|
conditional_t<is_range<T, Char>::value, /* implementation-defined */, std::integral_constant<range_format, range_format::disabled>> |
<fmt/ranges.h>
template<
typename T,
typename Char,
typename Enable = void>
struct range_formatter;
<fmt/ranges.h>
template<
typename T,
typename Char>
requires conjunction<std::is_same<T, remove_cvref_t<T>>,
is_formattable<T, Char>>::value
struct range_formatter<T, Char>;
Name | Description |
---|---|
range_formatter [constructor] | Default constructor |
format | |
parse | |
set_brackets | |
set_separator | |
underlying |
Default constructor
<fmt/ranges.h>
constexpr
range_formatter();
<fmt/ranges.h>
template<
typename R,
typename FormatContext>
decltype(ctx.out())
format(
R&& range,
FormatContext& ctx) const;
<fmt/ranges.h>
constexpr
void
set_brackets(
basic_string_view<Char> open,
basic_string_view<Char> close);
<fmt/ranges.h>
constexpr
/* implementation-defined */&
underlying();
<fmt/color.h>
struct rgb;
Name | Description |
---|---|
rgb [constructor] | Constructors |
Name |
---|
b |
g |
r |
Constructors
<fmt/color.h>
Default constructor
constexpr
rgb();
» more...
Construct from color
constexpr
rgb(color hex);
» more...
Construct from uint32_t
constexpr
rgb(uint32_t hex);
» more...
constexpr
rgb(
uint8_t r_,
uint8_t g_,
uint8_t b_);
» more...
Default constructor
<fmt/color.h>
constexpr
rgb();
Construct from color
Name | Description |
---|---|
hex | The object to construct from |
Construct from uint32_t
<fmt/color.h>
constexpr
rgb(uint32_t hex);
Name | Description |
---|---|
hex | The object to construct from |
<fmt/color.h>
constexpr
rgb(
uint8_t r_,
uint8_t g_,
uint8_t b_);
<fmt/color.h>
uint8_t b;
<fmt/color.h>
uint8_t g;
<fmt/color.h>
uint8_t r;
<fmt/base.h>
template<typename Char = char>
struct runtime_format_string;
Name |
---|
str |
Name | Description |
---|---|
runtime | Creates a runtime format string. |
<fmt/compile.h>
template<size_t N>
class static_format_result;
Name |
---|
static_format_result [constructor] |
c_str |
str |
<fmt/compile.h>
template<
typename S,
typename... T>
constexpr
explicit
static_format_result(
S const& fmt,
T...&&... args);
<fmt/compile.h>
char const*
c_str() const;
<fmt/format.h>
class string_buffer;
Name | Description |
---|---|
string_buffer [constructor] | Default constructor |
str | |
operator writer | Conversion to writer |
Default constructor
<fmt/format.h>
string_buffer();
<fmt/format.h>
std::string&
str();
Conversion to writer
writer
A text style consisting of foreground and background colors and emphasis.
<fmt/color.h>
class text_style;
Name | Description |
---|---|
text_style [constructor] | Construct from emphasis |
get_background | |
get_emphasis | |
get_foreground | |
has_background | |
has_emphasis | |
has_foreground | |
operator|= | Bitwise disjunction assignment operator |
operator== | Equality operator |
operator!= | Inequality operator |
Name | Description |
---|---|
bg |
Creates a text style from the background color. |
fg |
Creates a text style from the foreground (text) color. |
operator| |
Bitwise disjunction operator |
Name | Description |
---|---|
format | Formats arguments and returns the result as a string using ANSI escape sequences to specify text formatting. |
operator| | Bitwise disjunction operator |
print | Formats a string and prints it to stdout using ANSI escape sequences to specify text formatting. |
Construct from emphasis
Name | Description |
---|---|
em | The object to construct from |
<fmt/color.h>
constexpr
/* implementation-defined */
get_background() const noexcept;
<fmt/color.h>
constexpr
/* implementation-defined */
get_foreground() const noexcept;
<fmt/color.h>
constexpr
bool
has_background() const noexcept;
<fmt/color.h>
constexpr
bool
has_emphasis() const noexcept;
<fmt/color.h>
constexpr
bool
has_foreground() const noexcept;
Bitwise disjunction assignment operator
Name | Description |
---|---|
rhs | The right operand |
Equality operator
true
if the objects are equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
Inequality operator
true
if the objects are not equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
<fmt/ranges.h>
template<
typename Tuple,
typename Char>
struct tuple_join_view
: /* implementation-defined */
Name | Description |
---|---|
/* implementation-defined */ |
Name | Description |
---|---|
tuple_join_view [constructor] | Constructor |
Name |
---|
sep |
tuple |
Name | Description |
---|---|
join | Returns an object that formats std::tuple with elements separated by sep . |
Constructor
Name | Description |
---|---|
t | The object to copy construct from |
s | An implementation of std::basic_string_view for pre-C++17. It provides a subset of the API. fmt::basic_string_view is used for format strings 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). |
<fmt/ranges.h>
Tuple const& tuple;
<fmt/printf.h>
template<typename Char>
struct vprintf_args;
Name |
---|
type |
<fmt/chrono.h>
class weekday;
Name | Description |
---|---|
weekday [constructor] | Constructors |
c_encoding |
Constructors
<fmt/chrono.h>
Default constructor
constexpr
weekday() = default;
» more...
Construct from unsigned int
constexpr
explicit
weekday(unsigned int wd) noexcept;
» more...
Default constructor
<fmt/chrono.h>
constexpr
weekday() = default;
Construct from unsigned int
<fmt/chrono.h>
constexpr
explicit
weekday(unsigned int wd) noexcept;
Name | Description |
---|---|
wd | The value to construct from |
<fmt/chrono.h>
constexpr
unsigned int
c_encoding() const noexcept;
<fmt/format.h>
class writer;
Name | Description |
---|---|
writer [constructor] | Constructors |
print | Formats args according to specifications in fmt and writes the output to the file. |
Constructors
<fmt/format.h>
Construct from buffer
writer(/* implementation-defined */& buf);
» more...
Construct from FILE
writer(FILE* f);
» more...
Construct from buffer
<fmt/format.h>
writer(/* implementation-defined */& buf);
Name | Description |
---|---|
buf | The object to copy construct from |
Construct from FILE
<fmt/format.h>
writer(FILE* f);
Name | Description |
---|---|
f | The object to construct from |
Formats args
according to specifications in fmt
and writes the output to the file.
<fmt/format.h>
template<typename... T>
void
print(
format_string<T...> fmt,
T...&&... args);
<fmt/chrono.h>
class year;
Name | Description |
---|---|
year [constructor] | Constructors |
operator int | Conversion to int |
Constructors
<fmt/chrono.h>
Default constructor
constexpr
year() = default;
» more...
Construct from int
constexpr
explicit
year(int y) noexcept;
» more...
Default constructor
<fmt/chrono.h>
constexpr
year() = default;
Construct from int
<fmt/chrono.h>
constexpr
explicit
year(int y) noexcept;
Name | Description |
---|---|
y | The value to construct from |
Conversion to int
<fmt/chrono.h>
constexpr
explicit
operator int() const noexcept;
int
<fmt/chrono.h>
class year_month_day;
Name | Description |
---|---|
year_month_day [constructor] | Constructors |
day | |
month | |
year |
Constructors
<fmt/chrono.h>
Default constructor
constexpr
year_month_day() = default;
» more...
constexpr
year_month_day(
year const& y,
month const& m,
day const& d) noexcept;
» more...
Default constructor
<fmt/chrono.h>
constexpr
year_month_day() = default;
<fmt/chrono.h>
constexpr
year_month_day(
year const& y,
month const& m,
day const& d) noexcept;
<fmt/format.h>
enum Unnamed enum;
Name |
---|
inline_buffer_size |
<fmt/base.h>
enum class align : int;
Name |
---|
none |
left |
right |
center |
numeric |
<fmt/base.h>
enum class arg_id_kind : int;
Name |
---|
none |
index |
name |
<fmt/color.h>
enum class color : uint32_t;
Name |
---|
alice_blue |
antique_white |
aqua |
aquamarine |
azure |
beige |
bisque |
black |
blanched_almond |
blue |
blue_violet |
brown |
burly_wood |
cadet_blue |
chartreuse |
chocolate |
coral |
cornflower_blue |
cornsilk |
crimson |
cyan |
dark_blue |
dark_cyan |
dark_golden_rod |
dark_gray |
dark_green |
dark_khaki |
dark_magenta |
dark_olive_green |
dark_orange |
dark_orchid |
dark_red |
dark_salmon |
dark_sea_green |
dark_slate_blue |
dark_slate_gray |
dark_turquoise |
dark_violet |
deep_pink |
deep_sky_blue |
dim_gray |
dodger_blue |
fire_brick |
floral_white |
forest_green |
fuchsia |
gainsboro |
ghost_white |
gold |
golden_rod |
gray |
green |
green_yellow |
honey_dew |
hot_pink |
indian_red |
indigo |
ivory |
khaki |
lavender |
lavender_blush |
lawn_green |
lemon_chiffon |
light_blue |
light_coral |
light_cyan |
light_golden_rod_yellow |
light_gray |
light_green |
light_pink |
light_salmon |
light_sea_green |
light_sky_blue |
light_slate_gray |
light_steel_blue |
light_yellow |
lime |
lime_green |
linen |
magenta |
maroon |
medium_aquamarine |
medium_blue |
medium_orchid |
medium_purple |
medium_sea_green |
medium_slate_blue |
medium_spring_green |
medium_turquoise |
medium_violet_red |
midnight_blue |
mint_cream |
misty_rose |
moccasin |
navajo_white |
navy |
old_lace |
olive |
olive_drab |
orange |
orange_red |
orchid |
pale_golden_rod |
pale_green |
pale_turquoise |
pale_violet_red |
papaya_whip |
peach_puff |
peru |
pink |
plum |
powder_blue |
purple |
rebecca_purple |
red |
rosy_brown |
royal_blue |
saddle_brown |
salmon |
sandy_brown |
sea_green |
sea_shell |
sienna |
silver |
sky_blue |
slate_blue |
slate_gray |
snow |
spring_green |
steel_blue |
tan |
teal |
thistle |
tomato |
turquoise |
violet |
wheat |
white |
white_smoke |
yellow |
yellow_green |
<fmt/color.h>
enum class emphasis : uint8_t;
Name |
---|
bold |
faint |
italic |
underline |
blink |
reverse |
conceal |
strikethrough |
Name | Description |
---|---|
operator| | Bitwise disjunction operator |
<fmt/base.h>
enum class presentation_type : unsigned char;
Name |
---|
none |
debug |
string |
dec |
hex |
oct |
bin |
chr |
pointer |
exp |
fixed |
general |
hexfloat |
<fmt/ranges.h>
enum class range_format : int;
Name |
---|
disabled |
map |
set |
sequence |
string |
debug_string |
<fmt/base.h>
enum class sign : int;
Name |
---|
none |
minus |
plus |
space |
<fmt/color.h>
enum class terminal_color : uint8_t;
Name |
---|
black |
red |
green |
yellow |
blue |
magenta |
cyan |
white |
bright_black |
bright_red |
bright_green |
bright_yellow |
bright_blue |
bright_magenta |
bright_cyan |
bright_white |
<fmt/compile.h>
template</* implementation-defined */ S>
constexpr
auto
Unnamed function();
» more...
template</* implementation-defined */ Str>
constexpr
auto
Unnamed function();
» more...
<fmt/format.h>
template</* implementation-defined */ S>
constexpr
auto
Unnamed function();
<fmt/compile.h>
template</* implementation-defined */ Str>
constexpr
auto
Unnamed function();
Returns a named argument to be used in a formatting function. It should only be used in a call to a formatting function.
<fmt/base.h>
template<
typename Char,
typename T>
/* implementation-defined */
arg(
Char const* name,
T const& arg);
Example:
fmt::print("The answer is {answer}.", fmt::arg("answer", 42));
<fmt/base.h>
[[noreturn]]
void
assert_fail(
char const* file,
int line,
char const* message);
Creates a text style from the background color.
<fmt/color.h>
constexpr
text_style
bg(/* implementation-defined */ background) noexcept;
Creates a text style from the foreground (text) color.
<fmt/color.h>
constexpr
text_style
fg(/* implementation-defined */ foreground) noexcept;
format
overloads
<fmt/color.h>
Formats args
according to specifications in fmt
and returns the result as a string.
template<typename... T>
[[nodiscard, always_inline]]
std::string
format(
format_string<T...> fmt,
T...&&... args);
» more...
template<typename... T>
std::wstring
format(
wformat_string<T...> fmt,
T...&&... args);
» more...
template<
typename S,
typename... T>
[[always_inline]]
constexpr
std::basic_string<S::char_type>
format(
S const&,
T...&&... args);
» more...
template<
typename CompiledFormat,
typename... T,
typename Char = CompiledFormat::char_type>
[[always_inline]]
constexpr
std::basic_string<Char>
format(
CompiledFormat const& cf,
T const...&... args);
» more...
template<
typename S,
typename... T,
typename Char = /* implementation-defined */>
std::basic_string<Char>
format(
S const& fmt,
T...&&... args);
» more...
template<typename... T>
[[always_inline]]
std::string
format(
locale_ref loc,
format_string<T...> fmt,
T...&&... args);
» more...
Formats arguments and returns the result as a string using ANSI escape sequences to specify text formatting.
template<typename... T>
std::string
format(
text_style ts,
format_string<T...> fmt,
T...&&... args);
» more...
template<typename... T>
std::wstring
format(
text_style ts,
wformat_string<T...> fmt,
T...&&... args);
» more...
template<
typename S,
typename... T,
typename Char = /* implementation-defined */>
std::basic_string<Char>
format(
locale_ref loc,
S const& fmt,
T...&&... args);
» more...
Formats args
according to specifications in fmt
and returns the result as a string.
<fmt/format.h>
template<typename... T>
[[nodiscard, always_inline]]
std::string
format(
format_string<T...> fmt,
T...&&... args);
Example:
#include <fmt/format.h> std::string message = fmt::format("The answer is {}.", 42);
<fmt/xchar.h>
template<typename... T>
std::wstring
format(
wformat_string<T...> fmt,
T...&&... args);
<fmt/compile.h>
template<
typename S,
typename... T>
[[always_inline]]
constexpr
std::basic_string<S::char_type>
format(
S const&,
T...&&... args);
<fmt/compile.h>
template<
typename CompiledFormat,
typename... T,
typename Char = CompiledFormat::char_type>
[[always_inline]]
constexpr
std::basic_string<Char>
format(
CompiledFormat const& cf,
T const...&... args);
<fmt/xchar.h>
template<
typename S,
typename... T,
typename Char = /* implementation-defined */>
std::basic_string<Char>
format(
S const& fmt,
T...&&... args);
<fmt/format.h>
template<typename... T>
[[always_inline]]
std::string
format(
locale_ref loc,
format_string<T...> fmt,
T...&&... args);
Formats arguments and returns the result as a string using ANSI escape sequences to specify text formatting.
<fmt/color.h>
template<typename... T>
std::string
format(
text_style ts,
format_string<T...> fmt,
T...&&... args);
Example:
#include <fmt/color.h> std::string message = fmt::format(fmt::emphasis::bold | fg(fmt::color::red), "The answer is {}", 42);
Name | Description |
---|---|
ts | A text style consisting of foreground and background colors and emphasis. |
<fmt/xchar.h>
template<typename... T>
std::wstring
format(
text_style ts,
wformat_string<T...> fmt,
T...&&... args);
<fmt/xchar.h>
template<
typename S,
typename... T,
typename Char = /* implementation-defined */>
std::basic_string<Char>
format(
locale_ref loc,
S const& fmt,
T...&&... args);
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:
<fmt/format.h>
void
format_system_error(
/* implementation-defined */& out,
int error_code,
char const* message) noexcept;
<message>: <system-message>
where <message>
is the passed message and <system-message>
is the system message corresponding to the error code. error_code
is a system error code as given by errno
.
Name | Description |
---|---|
out | A contiguous memory buffer with an optional growing ability. It is an internal class and shouldn't be used directly, only via memory_buffer . |
format_to
overloads
<fmt/base.h>
template<
typename OutputIt,
typename... T>
OutputIt
format_to(
OutputIt out,
wformat_string<T...> fmt,
T...&&... args);
» more...
template<
size_t N,
typename... T>
[[always_inline]]
format_to_result
format_to(
char(& out)[],
format_string<T...> fmt,
T...&&... args);
» more...
Formats args
according to specifications in fmt
, writes the result to the output iterator out
and returns the iterator past the end of the output range. format_to
does not append a terminating null character.
template<
typename OutputIt,
typename... T>
[[always_inline]]
remove_cvref_t<OutputIt>
format_to(
OutputIt&& out,
format_string<T...> fmt,
T...&&... args);
» more...
template<
typename OutputIt,
typename CompiledFormat,
typename... T>
[[always_inline]]
constexpr
OutputIt
format_to(
OutputIt out,
CompiledFormat const& cf,
T const...&... args);
» more...
template<
typename OutputIt,
typename S,
typename... T>
constexpr
OutputIt
format_to(
OutputIt out,
S const&,
T...&&... args);
» more...
template<
typename OutputIt,
typename S,
typename... T,
typename Char = /* implementation-defined */>
OutputIt
format_to(
OutputIt out,
S const& fmt,
T...&&... args);
» more...
template<
typename OutputIt,
typename... T>
[[always_inline]]
OutputIt
format_to(
OutputIt out,
locale_ref loc,
format_string<T...> fmt,
T...&&... args);
» more...
Formats arguments with the given text style, writes the result to the output iterator out
and returns the iterator past the end of the output range.
template<
typename OutputIt,
typename... T>
OutputIt
format_to(
OutputIt out,
text_style ts,
format_string<T...> fmt,
T...&&... args);
» more...
template<
typename OutputIt,
typename S,
typename... T,
typename Char = /* implementation-defined */,
bool enable = detail::is_output_iterator<OutputIt, Char>::value && detail::is_exotic_char<Char>::value>
OutputIt
format_to(
OutputIt out,
locale_ref loc,
S const& fmt,
T...&&... args)
requires enable;
» more...
<fmt/xchar.h>
template<
typename OutputIt,
typename... T>
OutputIt
format_to(
OutputIt out,
wformat_string<T...> fmt,
T...&&... args);
<fmt/base.h>
template<
size_t N,
typename... T>
[[always_inline]]
format_to_result
format_to(
char(& out)[],
format_string<T...> fmt,
T...&&... args);
Formats args
according to specifications in fmt
, writes the result to the output iterator out
and returns the iterator past the end of the output range. format_to
does not append a terminating null character.
<fmt/base.h>
template<
typename OutputIt,
typename... T>
[[always_inline]]
remove_cvref_t<OutputIt>
format_to(
OutputIt&& out,
format_string<T...> fmt,
T...&&... args);
Example:
auto out = std::vector<char>(); fmt::format_to(std::back_inserter(out), "{}", 42);
<fmt/compile.h>
template<
typename OutputIt,
typename CompiledFormat,
typename... T>
[[always_inline]]
constexpr
OutputIt
format_to(
OutputIt out,
CompiledFormat const& cf,
T const...&... args);
<fmt/compile.h>
template<
typename OutputIt,
typename S,
typename... T>
constexpr
OutputIt
format_to(
OutputIt out,
S const&,
T...&&... args);
<fmt/xchar.h>
template<
typename OutputIt,
typename S,
typename... T,
typename Char = /* implementation-defined */>
OutputIt
format_to(
OutputIt out,
S const& fmt,
T...&&... args);
<fmt/format.h>
template<
typename OutputIt,
typename... T>
[[always_inline]]
OutputIt
format_to(
OutputIt out,
locale_ref loc,
format_string<T...> fmt,
T...&&... args);
Formats arguments with the given text style, writes the result to the output iterator out
and returns the iterator past the end of the output range.
<fmt/color.h>
template<
typename OutputIt,
typename... T>
OutputIt
format_to(
OutputIt out,
text_style ts,
format_string<T...> fmt,
T...&&... args);
Example:
std::vector<char> out; fmt::format_to(std::back_inserter(out), fmt::emphasis::bold | fg(fmt::color::red), "{}", 42);
Name | Description |
---|---|
ts | A text style consisting of foreground and background colors and emphasis. |
<fmt/xchar.h>
template<
typename OutputIt,
typename S,
typename... T,
typename Char = /* implementation-defined */,
bool enable = detail::is_output_iterator<OutputIt, Char>::value && detail::is_exotic_char<Char>::value>
OutputIt
format_to(
OutputIt out,
locale_ref loc,
S const& fmt,
T...&&... args)
requires enable;
Formats args
according to specifications in fmt
, writes up to n
characters of the result to the output iterator out
and returns the total (not truncated) output size and the iterator past the end of the output range. format_to_n
does not append a terminating null character.
<fmt/base.h>
Formats args
according to specifications in fmt
, writes up to n
characters of the result to the output iterator out
and returns the total (not truncated) output size and the iterator past the end of the output range. format_to_n
does not append a terminating null character.
template<
typename OutputIt,
typename... T>
[[always_inline]]
format_to_n_result<OutputIt>
format_to_n(
OutputIt out,
size_t n,
format_string<T...> fmt,
T...&&... args);
» more...
template<
typename OutputIt,
typename S,
typename... T>
format_to_n_result<OutputIt>
format_to_n(
OutputIt out,
size_t n,
S const& fmt,
T...&&... args);
» more...
template<
typename OutputIt,
typename S,
typename... T,
typename Char = /* implementation-defined */>
format_to_n_result<OutputIt>
format_to_n(
OutputIt out,
size_t n,
S const& fmt,
T...&&... args);
» more...
Formats args
according to specifications in fmt
, writes up to n
characters of the result to the output iterator out
and returns the total (not truncated) output size and the iterator past the end of the output range. format_to_n
does not append a terminating null character.
<fmt/base.h>
template<
typename OutputIt,
typename... T>
[[always_inline]]
format_to_n_result<OutputIt>
format_to_n(
OutputIt out,
size_t n,
format_string<T...> fmt,
T...&&... args);
<fmt/compile.h>
template<
typename OutputIt,
typename S,
typename... T>
format_to_n_result<OutputIt>
format_to_n(
OutputIt out,
size_t n,
S const& fmt,
T...&&... args);
<fmt/xchar.h>
template<
typename OutputIt,
typename S,
typename... T,
typename Char = /* implementation-defined */>
format_to_n_result<OutputIt>
format_to_n(
OutputIt out,
size_t n,
S const& fmt,
T...&&... args);
Returns the number of chars in the output of format(fmt, args...)
.
<fmt/base.h>
Returns the number of chars in the output of format(fmt, args...)
.
template<typename... T>
[[nodiscard, always_inline]]
size_t
formatted_size(
format_string<T...> fmt,
T...&&... args);
» more...
template<
typename S,
typename... T>
constexpr
size_t
formatted_size(
S const& fmt,
T...&&... args);
» more...
template<
typename S,
typename... T,
typename Char = /* implementation-defined */>
size_t
formatted_size(
S const& fmt,
T...&&... args);
» more...
template<typename... T>
[[nodiscard, always_inline]]
size_t
formatted_size(
locale_ref loc,
format_string<T...> fmt,
T...&&... args);
» more...
Returns the number of chars in the output of format(fmt, args...)
.
<fmt/base.h>
template<typename... T>
[[nodiscard, always_inline]]
size_t
formatted_size(
format_string<T...> fmt,
T...&&... args);
format(fmt, args...)
.
<fmt/compile.h>
template<
typename S,
typename... T>
constexpr
size_t
formatted_size(
S const& fmt,
T...&&... args);
<fmt/xchar.h>
template<
typename S,
typename... T,
typename Char = /* implementation-defined */>
size_t
formatted_size(
S const& fmt,
T...&&... args);
<fmt/format.h>
template<typename... T>
[[nodiscard, always_inline]]
size_t
formatted_size(
locale_ref loc,
format_string<T...> fmt,
T...&&... args);
Formats args
according to specifications in fmt
and writes the output to f
.
<fmt/printf.h>
Formats args
according to specifications in fmt
and writes the output to f
.
template<typename... T>
int
fprintf(
FILE* f,
string_view fmt,
T const...&... args);
» more...
template<typename... T>
[[deprecated]]
int
fprintf(
FILE* f,
basic_string_view<wchar_t> fmt,
T const...&... args);
» more...
Formats args
according to specifications in fmt
and writes the output to f
.
<fmt/printf.h>
template<typename... T>
int
fprintf(
FILE* f,
string_view fmt,
T const...&... args);
Example:
fmt::fprintf(stderr, "Don't %s!", "panic");
<fmt/printf.h>
template<typename... T>
[[deprecated]]
int
fprintf(
FILE* f,
basic_string_view<wchar_t> fmt,
T const...&... args);
Converts given time since epoch as std::time_t
value into calendar time, expressed in Coordinated Universal Time (UTC). Unlike std::gmtime
, this function is thread-safe on most platforms.
<fmt/chrono.h>
Converts given time since epoch as std::time_t
value into calendar time, expressed in Coordinated Universal Time (UTC). Unlike std::gmtime
, this function is thread-safe on most platforms.
tm
gmtime(time_t time);
» more...
template<typename Duration>
tm
gmtime(sys_time<Duration> time_point);
» more...
Converts given time since epoch as std::time_t
value into calendar time, expressed in Coordinated Universal Time (UTC). Unlike std::gmtime
, this function is thread-safe on most platforms.
<fmt/chrono.h>
tm
gmtime(time_t time);
<fmt/chrono.h>
template<typename Duration>
tm
gmtime(sys_time<Duration> time_point);
Returns a view that formats an integer value using ',' as a locale-independent thousands separator.
<fmt/format.h>
template<typename T>
group_digits_view<T>
group_digits(T value);
Example:
fmt::print("{}", fmt::group_digits(12345)); // Output: "12,345"
join
overloads
<fmt/ranges.h>
Returns an object that formats std::initializer_list
with elements separated by sep
.
template<typename T>
join_view<T const*, T const*>
join(
std::initializer_list<T> list,
string_view sep);
» more...
template<typename T>
join_view<T const*, T const*, wchar_t>
join(
std::initializer_list<T> list,
wstring_view sep);
» more...
Returns an object that formats std::tuple
with elements separated by sep
.
template<typename Tuple>
constexpr
tuple_join_view<Tuple, char>
join(
Tuple const& tuple,
string_view sep);
» more...
template<typename Tuple>
tuple_join_view<Tuple, wchar_t>
join(
Tuple const& tuple,
basic_string_view<wchar_t> sep);
» more...
Returns a view that formats range
with elements separated by sep
.
template<typename Range>
join_view<decltype(detail::range_begin(r)), decltype(detail::range_end(r))>
join(
Range&& r,
string_view sep);
» more...
template<typename Range>
join_view<decltype(std::begin(range)), decltype(std::end(range)), wchar_t>
join(
Range&& range,
wstring_view sep);
» more...
Returns a view that formats the iterator range [begin, end)
with elements separated by sep
.
template<
typename It,
typename Sentinel>
join_view<It, Sentinel>
join(
It begin,
Sentinel end,
string_view sep);
» more...
template<
typename It,
typename Sentinel>
join_view<It, Sentinel, wchar_t>
join(
It begin,
Sentinel end,
wstring_view sep);
» more...
Returns an object that formats std::initializer_list
with elements separated by sep
.
<fmt/ranges.h>
template<typename T>
join_view<T const*, T const*>
join(
std::initializer_list<T> list,
string_view sep);
Example:
fmt::print("{}", fmt::join({1, 2, 3}, ", ")); // Output: "1, 2, 3"
<fmt/xchar.h>
template<typename T>
join_view<T const*, T const*, wchar_t>
join(
std::initializer_list<T> list,
wstring_view sep);
Returns an object that formats std::tuple
with elements separated by sep
.
<fmt/ranges.h>
template<typename Tuple>
constexpr
tuple_join_view<Tuple, char>
join(
Tuple const& tuple,
string_view sep);
Example:
auto t = std::tuple<int, char>(1, 'a'); fmt::print("{}", fmt::join(t, ", ")); // Output: 1, a
std::tuple
with elements separated by sep
.
<fmt/xchar.h>
template<typename Tuple>
tuple_join_view<Tuple, wchar_t>
join(
Tuple const& tuple,
basic_string_view<wchar_t> sep);
Returns a view that formats range
with elements separated by sep
.
<fmt/ranges.h>
template<typename Range>
join_view<decltype(detail::range_begin(r)), decltype(detail::range_end(r))>
join(
Range&& r,
string_view sep);
Example:
auto v = std::vector<int>{1, 2, 3}; fmt::print("{}", fmt::join(v, ", ")); // Output: 1, 2, 3
fmt::join
applies passed format specifiers to the range elements:
fmt::print("{:02}", fmt::join(v, ", ")); // Output: 01, 02, 03
range
with elements separated by sep
.
<fmt/xchar.h>
template<typename Range>
join_view<decltype(std::begin(range)), decltype(std::end(range)), wchar_t>
join(
Range&& range,
wstring_view sep);
Returns a view that formats the iterator range [begin, end)
with elements separated by sep
.
<fmt/ranges.h>
template<
typename It,
typename Sentinel>
join_view<It, Sentinel>
join(
It begin,
Sentinel end,
string_view sep);
<fmt/xchar.h>
template<
typename It,
typename Sentinel>
join_view<It, Sentinel, wchar_t>
join(
It begin,
Sentinel end,
wstring_view sep);
<fmt/base.h>
template<
typename Context = context,
typename... T,
int NUM_ARGS = sizeof...(T),
int NUM_NAMED_ARGS = detail::count_named_args<T...>(),
unsigned long long DESC = detail::make_descriptor<Context, T...>()>
[[always_inline]]
constexpr
/* implementation-defined */
make_format_args(T...&... args);
Constructs an format_arg_store
object that contains references to arguments and can be implicitly converted to printf_args
.
<fmt/printf.h>
template<
typename Char = char,
typename... T>
decltype(fmt::make_format_args<basic_printf_context<Char>>(args...))
make_printf_args(T...&... args);
<fmt/xchar.h>
template<typename... T>
constexpr
decltype(fmt::make_format_args<wformat_context>(args...))
make_wformat_args(T...&... args);
<fmt/base.h>
template<typename T>
constexpr
T
max_of(
T a,
T b);
<fmt/base.h>
template<typename T>
constexpr
T
min_of(
T a,
T b);
Bitwise disjunction operators
<fmt/color.h>
Bitwise disjunction operator
constexpr
text_style
operator|(
emphasis lhs,
emphasis rhs) noexcept;
» more...
Bitwise disjunction operator
constexpr
text_style
operator|(
text_style lhs,
text_style rhs);
» more...
Bitwise disjunction operator
<fmt/color.h>
constexpr
text_style
operator|(
emphasis lhs,
emphasis rhs) noexcept;
Name | Description |
---|---|
lhs | The left operand |
rhs | The right operand |
Bitwise disjunction operator
Name | Description |
---|---|
lhs | The left operand |
rhs | The right operand |
print
overloads
<fmt/base.h>
Formats args
according to specifications in fmt
and writes the output to stdout
.
template<typename... T>
[[always_inline]]
void
print(
format_string<T...> fmt,
T...&&... args);
» more...
template<typename... T>
void
print(
wformat_string<T...> fmt,
T...&&... args);
» more...
template<
typename S,
typename... T>
void
print(
S const& fmt,
T...&&... args);
» more...
Formats a string and prints it to stdout using ANSI escape sequences to specify text formatting.
template<typename... T>
void
print(
text_style ts,
format_string<T...> fmt,
T...&&... args);
» more...
Prints formatted data to the stream os
.
template<typename... T>
void
print(
std::ostream& os,
format_string<T...> fmt,
T...&&... args);
» more...
template<typename... T>
void
print(
std::wostream& os,
wformat_string<T...> fmt,
T...&&... args);
» more...
Formats args
according to specifications in fmt
and writes the output to the file f
.
template<typename... T>
[[always_inline]]
void
print(
FILE* f,
format_string<T...> fmt,
T...&&... args);
» more...
template<typename... T>
void
print(
FILE* f,
wformat_string<T...> fmt,
T...&&... args);
» more...
template<
typename S,
typename... T>
void
print(
FILE* f,
S const& fmt,
T...&&... args);
» more...
Formats a string and prints it to the specified file stream using ANSI escape sequences to specify text formatting.
template<typename... T>
void
print(
FILE* f,
text_style ts,
format_string<T...> fmt,
T...&&... args);
» more...
Formats args
according to specifications in fmt
and writes the output to stdout
.
<fmt/base.h>
template<typename... T>
[[always_inline]]
void
print(
format_string<T...> fmt,
T...&&... args);
Example:
fmt::print("The answer is {}.", 42);
<fmt/xchar.h>
template<typename... T>
void
print(
wformat_string<T...> fmt,
T...&&... args);
<fmt/compile.h>
template<
typename S,
typename... T>
void
print(
S const& fmt,
T...&&... args);
Formats a string and prints it to stdout using ANSI escape sequences to specify text formatting.
<fmt/color.h>
template<typename... T>
void
print(
text_style ts,
format_string<T...> fmt,
T...&&... args);
Example:
fmt::print(fmt::emphasis::bold | fg(fmt::color::red), "Elapsed time: {0:.2f} seconds", 1.23);
Name | Description |
---|---|
ts | A text style consisting of foreground and background colors and emphasis. |
Prints formatted data to the stream os
.
<fmt/ostream.h>
template<typename... T>
void
print(
std::ostream& os,
format_string<T...> fmt,
T...&&... args);
Example:
fmt::print(cerr, "Don't {}!", "panic");
<fmt/xchar.h>
template<typename... T>
void
print(
std::wostream& os,
wformat_string<T...> fmt,
T...&&... args);
Formats args
according to specifications in fmt
and writes the output to the file f
.
<fmt/base.h>
template<typename... T>
[[always_inline]]
void
print(
FILE* f,
format_string<T...> fmt,
T...&&... args);
Example:
fmt::print(stderr, "Don't {}!", "panic");
<fmt/xchar.h>
template<typename... T>
void
print(
FILE* f,
wformat_string<T...> fmt,
T...&&... args);
<fmt/compile.h>
template<
typename S,
typename... T>
void
print(
FILE* f,
S const& fmt,
T...&&... args);
Formats a string and prints it to the specified file stream using ANSI escape sequences to specify text formatting.
<fmt/color.h>
template<typename... T>
void
print(
FILE* f,
text_style ts,
format_string<T...> fmt,
T...&&... args);
Example:
fmt::print(fmt::emphasis::bold | fg(fmt::color::red), "Elapsed time: {0:.2f} seconds", 1.23);
Name | Description |
---|---|
ts | A text style consisting of foreground and background colors and emphasis. |
Formats args
according to specifications in fmt
and writes the output to stdout
.
<fmt/printf.h>
template<typename... T>
int
printf(
string_view fmt,
T const...&... args);
Example:
fmt::printf("Elapsed time: %.2f seconds", 1.23);
println
overloads
<fmt/base.h>
Formats args
according to specifications in fmt
and writes the output to stdout
followed by a newline.
template<typename... T>
[[always_inline]]
void
println(
format_string<T...> fmt,
T...&&... args);
» more...
template<typename... T>
void
println(
wformat_string<T...> fmt,
T...&&... args);
» more...
template<typename... T>
void
println(
std::ostream& os,
format_string<T...> fmt,
T...&&... args);
» more...
template<typename... T>
void
println(
std::wostream& os,
wformat_string<T...> fmt,
T...&&... args);
» more...
Formats args
according to specifications in fmt
and writes the output to the file f
followed by a newline.
template<typename... T>
[[always_inline]]
void
println(
FILE* f,
format_string<T...> fmt,
T...&&... args);
» more...
template<typename... T>
void
println(
FILE* f,
wformat_string<T...> fmt,
T...&&... args);
» more...
Formats args
according to specifications in fmt
and writes the output to stdout
followed by a newline.
<fmt/base.h>
template<typename... T>
[[always_inline]]
void
println(
format_string<T...> fmt,
T...&&... args);
<fmt/xchar.h>
template<typename... T>
void
println(
wformat_string<T...> fmt,
T...&&... args);
<fmt/ostream.h>
template<typename... T>
void
println(
std::ostream& os,
format_string<T...> fmt,
T...&&... args);
<fmt/xchar.h>
template<typename... T>
void
println(
std::wostream& os,
wformat_string<T...> fmt,
T...&&... args);
Formats args
according to specifications in fmt
and writes the output to the file f
followed by a newline.
<fmt/base.h>
template<typename... T>
[[always_inline]]
void
println(
FILE* f,
format_string<T...> fmt,
T...&&... args);
<fmt/xchar.h>
template<typename... T>
void
println(
FILE* f,
wformat_string<T...> fmt,
T...&&... args);
Converts p
to const void*
for pointer formatting.
<fmt/format.h>
Converts p
to const void*
for pointer formatting.
template<typename T>
void const*
ptr(T p);
» more...
template<typename T>
void const*
ptr(std::shared_ptr<T> const& p);
» more...
template<
typename T,
typename Deleter>
void const*
ptr(std::unique_ptr<T, Deleter> const& p);
» more...
Converts p
to const void*
for pointer formatting.
<fmt/format.h>
template<typename T>
void const*
ptr(T p);
Example:
auto s = fmt::format("{}", fmt::ptr(p));
<fmt/std.h>
template<typename T>
void const*
ptr(std::shared_ptr<T> const& p);
<fmt/std.h>
template<
typename T,
typename Deleter>
void const*
ptr(std::unique_ptr<T, Deleter> const& p);
Reports a format error at compile time or, via a format_error
exception, at runtime.
<fmt/base.h>
[[noreturn]]
void
report_error(char const* message);
<fmt/format.h>
void
report_system_error(
int error_code,
char const* message) noexcept;
Creates a runtime format string.
<fmt/base.h>
Creates a runtime format string.
runtime_format_string
runtime(string_view s);
» more...
runtime_format_string<wchar_t>
runtime(wstring_view s);
» more...
Creates a runtime format string.
Example:
// Check format string at runtime instead of compile-time. fmt::print(fmt::runtime("{:d}"), "I am not a number");
Formats args
according to specifications in fmt
and returns the result as as string.
<fmt/printf.h>
Formats args
according to specifications in fmt
and returns the result as as string.
template<typename... T>
std::string
sprintf(
string_view fmt,
T const...&... args);
» more...
template<typename... T>
[[deprecated]]
std::wstring
sprintf(
basic_string_view<wchar_t> fmt,
T const...&... args);
» more...
Formats args
according to specifications in fmt
and returns the result as as string.
<fmt/printf.h>
template<typename... T>
std::string
sprintf(
string_view fmt,
T const...&... args);
Example:
std::string message = fmt::sprintf("The answer is %d", 42);
<fmt/printf.h>
template<typename... T>
[[deprecated]]
std::wstring
sprintf(
basic_string_view<wchar_t> fmt,
T const...&... args);
Returns a view that formats value
via an ostream operator<<
.
<fmt/ostream.h>
template<typename T>
constexpr
/* implementation-defined */
streamed(T const& value);
Example:
fmt::print("Current thread id: {}n", fmt::streamed(std::this_thread::get_id()));
value
via an ostream operator<<
.
Returns an argument that will be formatted using ANSI escape sequences, to be used in a formatting function.
<fmt/color.h>
template<typename T>
constexpr
/* implementation-defined */
styled(
T const& value,
text_style ts);
Example:
fmt::print("Elapsed time: {0:.2f} seconds", fmt::styled(1.23, fmt::fg(fmt::color::green) | fmt::bg(fmt::color::blue)));
Name | Description |
---|---|
ts | A text style consisting of foreground and background colors and emphasis. |
<fmt/os.h>
std::error_category const&
system_category() noexcept;
Constructs std::system_error
with a message formatted with fmt::format(fmt, args...)
. error_code
is a system error code as given by errno
.
<fmt/format.h>
template<typename... T>
std::system_error
system_error(
int error_code,
format_string<T...> fmt,
T...&&... args);
Example:
// This throws std::system_error with the description // cannot open file 'madeup': No such file or directory // or similar (system message may vary). const char* filename = "madeup"; FILE* file = fopen(filename, "r"); if (!file) throw fmt::system_error(errno, "cannot open file '{}'", filename);
Converts value
to std::string
using the default format for type T
.
<fmt/format.h>
Converts value
to std::string
using the default format for type T
.
template<typename T>
[[nodiscard]]
constexpr
std::string
to_string(T value);
» more...
template<typename T>
[[nodiscard]]
constexpr
std::string
to_string(T const& value);
» more...
template<typename T>
[[nodiscard]]
constexpr
std::string
to_string(T const& value);
» more...
template<size_t SIZE>
[[nodiscard]]
std::string
to_string(basic_memory_buffer<char, SIZE> const& buf);
» more...
Converts value
to std::string
using the default format for type T
.
<fmt/format.h>
template<typename T>
[[nodiscard]]
constexpr
std::string
to_string(T value);
Example:
std::string answer = fmt::to_string(42);
<fmt/format.h>
template<typename T>
[[nodiscard]]
constexpr
std::string
to_string(T const& value);
<fmt/format.h>
template<typename T>
[[nodiscard]]
constexpr
std::string
to_string(T const& value);
<fmt/format.h>
template<size_t SIZE>
[[nodiscard]]
std::string
to_string(basic_memory_buffer<char, SIZE> const& buf);
Converts value
to std::wstring
using the default format for type T
.
<fmt/xchar.h>
template<typename T>
std::wstring
to_wstring(T const& value);
Converts e
to the underlying type.
<fmt/format.h>
template<typename Enum>
constexpr
underlying_t<Enum>
underlying(Enum e) noexcept;
Example:
enum class color { red, green, blue }; auto s = fmt::format("{}", fmt::underlying(color::red)); // s == "0"
<fmt/format.h>
std::string
vformat(
string_view fmt,
format_args args);
» more...
template<typename Char>
std::basic_string<Char>
vformat(
basic_string_view<Char> fmt,
basic_format_args<buffered_context<Char>> args);
» more...
std::string
vformat(
locale_ref loc,
string_view fmt,
format_args args);
» more...
std::string
vformat(
text_style ts,
string_view fmt,
format_args args);
» more...
std::wstring
vformat(
text_style ts,
wstring_view fmt,
wformat_args args);
» more...
template<
typename S,
typename Char = /* implementation-defined */>
std::basic_string<Char>
vformat(
locale_ref loc,
S const& fmt,
basic_format_args<buffered_context<Char>> args);
» more...
<fmt/xchar.h>
template<typename Char>
std::basic_string<Char>
vformat(
basic_string_view<Char> fmt,
basic_format_args<buffered_context<Char>> args);
<fmt/format.h>
std::string
vformat(
locale_ref loc,
string_view fmt,
format_args args);
<fmt/color.h>
std::string
vformat(
text_style ts,
string_view fmt,
format_args args);
<fmt/xchar.h>
std::wstring
vformat(
text_style ts,
wstring_view fmt,
wformat_args args);
<fmt/xchar.h>
template<
typename S,
typename Char = /* implementation-defined */>
std::basic_string<Char>
vformat(
locale_ref loc,
S const& fmt,
basic_format_args<buffered_context<Char>> args);
vformat_to
overloads
<fmt/base.h>
template<size_t N>
format_to_result
vformat_to(
char(& out)[],
string_view fmt,
format_args args);
» more...
Formats a string and writes the output to out
.
template<typename OutputIt>
remove_cvref_t<OutputIt>
vformat_to(
OutputIt&& out,
string_view fmt,
format_args args);
» more...
template<
typename OutputIt,
typename S,
typename Char = /* implementation-defined */>
OutputIt
vformat_to(
OutputIt out,
S const& fmt,
basic_format_args<buffered_context<Char>> args);
» more...
template<typename OutputIt>
OutputIt
vformat_to(
OutputIt out,
locale_ref loc,
string_view fmt,
format_args args);
» more...
Formats a string with the given text_style and writes the output to out
.
template<typename OutputIt>
OutputIt
vformat_to(
OutputIt out,
text_style ts,
string_view fmt,
format_args args);
» more...
template<
typename S,
typename OutputIt,
typename... Args,
typename Char = /* implementation-defined */>
OutputIt
vformat_to(
OutputIt out,
locale_ref loc,
S const& fmt,
basic_format_args<buffered_context<Char>> args);
» more...
<fmt/base.h>
template<size_t N>
format_to_result
vformat_to(
char(& out)[],
string_view fmt,
format_args args);
Formats a string and writes the output to out
.
<fmt/base.h>
template<typename OutputIt>
remove_cvref_t<OutputIt>
vformat_to(
OutputIt&& out,
string_view fmt,
format_args args);
<fmt/xchar.h>
template<
typename OutputIt,
typename S,
typename Char = /* implementation-defined */>
OutputIt
vformat_to(
OutputIt out,
S const& fmt,
basic_format_args<buffered_context<Char>> args);
<fmt/format.h>
template<typename OutputIt>
OutputIt
vformat_to(
OutputIt out,
locale_ref loc,
string_view fmt,
format_args args);
Formats a string with the given text_style and writes the output to out
.
<fmt/color.h>
template<typename OutputIt>
OutputIt
vformat_to(
OutputIt out,
text_style ts,
string_view fmt,
format_args args);
Name | Description |
---|---|
ts | A text style consisting of foreground and background colors and emphasis. |
<fmt/xchar.h>
template<
typename S,
typename OutputIt,
typename... Args,
typename Char = /* implementation-defined */>
OutputIt
vformat_to(
OutputIt out,
locale_ref loc,
S const& fmt,
basic_format_args<buffered_context<Char>> args);
<fmt/base.h>
template<
typename OutputIt,
typename... T>
format_to_n_result<OutputIt>
vformat_to_n(
OutputIt out,
size_t n,
string_view fmt,
format_args args);
» more...
template<
typename OutputIt,
typename Char,
typename... Args>
format_to_n_result<OutputIt>
vformat_to_n(
OutputIt out,
size_t n,
basic_string_view<Char> fmt,
basic_format_args<buffered_context<Char>> args);
» more...
<fmt/base.h>
template<
typename OutputIt,
typename... T>
format_to_n_result<OutputIt>
vformat_to_n(
OutputIt out,
size_t n,
string_view fmt,
format_args args);
<fmt/xchar.h>
template<
typename OutputIt,
typename Char,
typename... Args>
format_to_n_result<OutputIt>
vformat_to_n(
OutputIt out,
size_t n,
basic_string_view<Char> fmt,
basic_format_args<buffered_context<Char>> args);
<fmt/printf.h>
template<typename Char>
int
vfprintf(
FILE* f,
basic_string_view<Char> fmt,
vprintf_args<Char>::type args);
<fmt/base.h>
void
vprint(
string_view fmt,
format_args args);
» more...
void
vprint(
wstring_view fmt,
wformat_args args);
» more...
void
vprint(
std::ostream& os,
string_view fmt,
format_args args);
» more...
void
vprint(
std::wostream& os,
wstring_view fmt,
wformat_args args);
» more...
void
vprint(
FILE* f,
string_view fmt,
format_args args);
» more...
void
vprint(
FILE* f,
wstring_view fmt,
wformat_args args);
» more...
void
vprint(
FILE* f,
text_style ts,
string_view fmt,
format_args args);
» more...
<fmt/ostream.h>
void
vprint(
std::ostream& os,
string_view fmt,
format_args args);
<fmt/xchar.h>
void
vprint(
std::wostream& os,
wstring_view fmt,
wformat_args args);
<fmt/color.h>
void
vprint(
FILE* f,
text_style ts,
string_view fmt,
format_args args);
<fmt/base.h>
void
vprint_buffered(
FILE* f,
string_view fmt,
format_args args);
<fmt/printf.h>
template<typename Char>
std::basic_string<Char>
vsprintf(
basic_string_view<Char> fmt,
vprintf_args<Char>::type args);
<fmt/format.h>
std::system_error
vsystem_error(
int error_code,
string_view fmt,
format_args args);
Equality operator
<fmt/base.h>
constexpr
bool
operator==(
basic_string_view lhs,
basic_string_view rhs);
true
if the objects are equal, false
otherwise
Name | Description |
---|---|
lhs | The left operand |
rhs | The right operand |
Inequality operator
true
if the objects are not equal, false
otherwise
Name | Description |
---|---|
lhs | The left operand |
rhs | The right operand |
Less-than operator
true
if the left object is less than the right object, false
otherwise
Name | Description |
---|---|
lhs | The left operand |
rhs | The right operand |
Less-than-or-equal operator
true
if the left object is less than or equal to the right object, false
otherwise
Name | Description |
---|---|
lhs | The left operand |
rhs | The right operand |
Greater-than operator
true
if the left object is greater than the right object, false
otherwise
Name | Description |
---|---|
lhs | The left operand |
rhs | The right operand |
Greater-than-or-equal operator
true
if the left object is greater than or equal to the right object, false
otherwise
Name | Description |
---|---|
lhs | The left operand |
rhs | The right operand |
<fmt/base.h>
template<
typename T,
typename Char = char>
concept formattable = is_formattable<remove_reference_t<T>, Char>::value;