Date: Thu, 2 Dec 2021 19:38:25 +0000
The adopted proposal, P2216R3
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2216r3.html>,
modified std::format to take an initial *basic-format-string* parameter so
that type checking could be performed at compile time. The proposal chose
to make the type of the argument parameter unspecified as it considered it
an implementation detail. However, consider the common use case:
template <typename... Args>void log(std::format_string<Args...> s,
Args&&... args) {
if (logging_enabled) {
log_raw(std::format(s, std::forward<Args>(args)...));
}
}
Without a specified std::format_string type, is it possible to forward
arguments to std::format with compile-time format string checks? I'm
thinking about this as an average user of the standard library, so I'm
not looking for workarounds. Is this a defect?
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2216r3.html>,
modified std::format to take an initial *basic-format-string* parameter so
that type checking could be performed at compile time. The proposal chose
to make the type of the argument parameter unspecified as it considered it
an implementation detail. However, consider the common use case:
template <typename... Args>void log(std::format_string<Args...> s,
Args&&... args) {
if (logging_enabled) {
log_raw(std::format(s, std::forward<Args>(args)...));
}
}
Without a specified std::format_string type, is it possible to forward
arguments to std::format with compile-time format string checks? I'm
thinking about this as an average user of the standard library, so I'm
not looking for workarounds. Is this a defect?
Received on 2021-12-02 13:39:03