std::basic_format_arg
<format>
class basic_format_arg;
Provides access to a formatting argument.
basic_format_arg
objects are typically created by std::make_format_args and accessed through std::visit_format_arg or the visit
member functions(since C++26).
A basic_format_arg
object behaves as if it contains a std::variant of the following types:
- std::monostate (only if the object was default-constructed)
- bool
- Context::char_type
- int
- unsigned int
- long long int
- unsigned long long int
- float
- double
- long double
- const Context::char_type*
- std::basic_string_view <Context::char_type>
- const void*
- basic_format_arg::handle
Contents
[edit] Member classes
(public member class)
[edit] Member functions
std::basic_format_arg
(public member function)
(public member function)
(public member function)
[edit] Non-member functions
(function template) [edit]
std::basic_format_arg::basic_format_arg
Default constructor. Constructs a basic_format_arg
that does not hold a formatting argument. The contained object has type std::monostate .
To create a basic_format_arg
that holds a formatting argument, std::make_format_args has to be used.
std::basic_format_arg::operator bool
Checks whether *this holds a formatting argument.
Returns true if *this holds a formatting argument (i.e. the contained object does not have type std::monostate ), false otherwise.
std::basic_format_arg::visit
decltype(auto) visit( this basic_format_arg arg, Visitor&& vis );
R visit( this basic_format_arg arg, Visitor&& vis );
Applies the visitor vis to the object contained in arg.
The visit
functions do not modify the basic_format_arg
object on which it is called because a copy of the object is used when calling vis.
v
is the std::variant contained in arg.v
is the std::variant contained in arg.
[edit] Notes
Feature-test macro | Value | Std | Feature |
---|---|---|---|
__cpp_lib_format |
202306L |
(C++26) | Member visit
|
[edit] Example
Reason: no example
[edit] See also
(class template) [edit]