Localization library | |||||||||||||||||||||||||
Regular expressions library(C++11) | |||||||||||||||||||||||||
Formatting library(C++20) | |||||||||||||||||||||||||
Null-terminated sequence utilities | |||||||||||||||||||||||||
Byte strings | |||||||||||||||||||||||||
Multibyte strings | |||||||||||||||||||||||||
Wide strings | |||||||||||||||||||||||||
Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
Text encoding identifications | |||||||||||||||||||||||||
|
Standard format specification | ||||
Formatting functions | ||||
(C++20) | ||||
(C++20) | ||||
(C++20) | ||||
(C++20) | ||||
(C++20) | ||||
(C++20) | ||||
Format strings | ||||
(C++20)(C++20)(C++20) | ||||
(C++26) | ||||
Formatting concepts | ||||
(C++23) | ||||
Formatter | ||||
(C++20) | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++20)(C++20)(C++20) | ||||
(C++20)(C++20)(C++20) | ||||
(C++23) | ||||
(C++23) | ||||
Formatting arguments | ||||
basic_format_arg (C++20) | ||||
(C++20) | ||||
(C++20)(C++20)(C++20) | ||||
(C++20)(deprecated in C++26) | ||||
(C++20)(C++20) | ||||
Format error | ||||
(C++20) |
Defined in header <format> | ||
template<class Context> class basic_format_arg; | (since C++20) | |
Provides access to a formatting argument.
basic_format_arg
objects are typically created bystd::make_format_args and accessed throughstd::visit_format_arg or thevisit
member functions(since C++26).
Abasic_format_arg
object behaves as if it contains astd::variant of the following types:
Contents |
(C++20) | type-erased wrapper that allows formatting an object of user-defined type (public member class) |
(constructor) (C++20) | constructs astd::basic_format_arg (public member function) |
operator bool (C++20) | checks if the current object holds a formatting argument (public member function) |
visit (C++26) | visit the contained formatting argument (public member function) |
(C++20)(deprecated in C++26) | argument visitation interface for user-defined formatters (function template)[edit] |
basic_format_arg()noexcept; | (since C++20) | |
Default constructor. Constructs abasic_format_arg
that does not hold a formatting argument. The contained object has typestd::monostate.
To create abasic_format_arg
that holds a formatting argument,std::make_format_args has to be used.
explicit operatorbool()constnoexcept; | (since C++20) | |
Checks whether*this holds a formatting argument.
Returnstrue if*this holds a formatting argument (i.e. the contained object does not have typestd::monostate),false otherwise.
template<class Visitor> decltype(auto) visit( this basic_format_arg arg, Visitor&& vis); | (1) | (since C++26) |
template<class R,class Visitor> R visit( this basic_format_arg arg, Visitor&& vis); | (2) | (since C++26) |
Applies the visitorvis to the object contained inarg.
Thevisit
functions do not modify thebasic_format_arg
object on which it is called because a copy of the object is used when callingvis.
v
is thestd::variant contained inarg.v
is thestd::variant contained inarg.Feature-test macro | Value | Std | Feature |
---|---|---|---|
__cpp_lib_format | 202306L | (C++26) | Membervisit |
This section is incomplete Reason: no example |
(C++20)(C++20)(C++20) | class that provides access to all formatting arguments (class template)[edit] |