|
BDE 4.39.x Production Release
|
Provide a proxy for an argument for use by bsl::format.
Provide a proxy for an argument for use by bsl::format
bsl_format.h
This component provides an implementation of the C++20 Standard Library's basic_format_arg , providing access via a "visitor pattern". The value is stored as if using a variant of the following types (as specified by the Standard):
bsl::monostate (only if the object was default-constructed)boolContext::char_typeintunsigned intlong long intunsigned long long intfloatdoublelong doubleconst Context::char_type *bsl::basic_string_view<Context::char_type>const void *basic_format_arg::handleWhere basic_format_arg::handle is a type-erased wrapper holding a reference to a user-defined type.
This header is not intended to be included directly. Please include <bsl_format.h> to be able to use bsl::basic_format_arg.
bsl::basic_format_arg differs from the C++20 standard as follows: we provide the C++23 member visit, but we do not provide the overload of visit that accepts an explicitly specified return type.
In this section we show the intended use of this component.
We do not expect most users of bsl::format to interact with this type directly and instead use bsl::format or bsl::vformat. In addition, there are only a very limited number of public methods so this example is necessarily unrealistic.
Suppose we want to construct a default-constructed basic_format_arg and verify that it contains no value.