|
BDE 4.39.x Production Release
|
Provide a string_view wrapper for formatting library usage.
Provide a string_view wrapper for formatting library usage
bsl_format.h
This component provides an implementation of the C++20 Standard Library's basic_format_string , providing wrapper around string_view for format specification strings.
Using this rather than string_view directly serves three main purposes:
format and vformat are consistent with the standard library, which takes a format_string rather than a string_view .const t_CHAR* we can limit the number of scenarios which would fail to compile under C++20 but succeed under earlier versions.std::format_string (not yet implemented).Suppression of the argument deduction that would normally result in a compile-time error requires that we use intermediate template aliases for format_string and wformat_string . As this is not possible under C++03, usage of this type necessarily differs under C++03. This is acceptable as this type is typically only used internally within the bslfmt::format family of functions.
This header is not intended to be included directly. Please include <bsl_format.h> to be able to use bsl::basic_format_string.
In this section we show the intended use of this component.
This usage example reflects how bslfmt::format typically uses this type.
Suppose we have a function that takes a format string and requires that the string be constant evaluated under C++20:
We can then invoke our function: