Namespaces
Variants
Views
Actions

Talk:cpp/utility/format/formatter

From cppreference.com
< Talk:cpp‎ | utility‎ | format
Revision as of 06:51, 8 November 2023 by Studyingegret (Talk | contribs)

Reordering of arguments in output?

The referred python format allows re-ordering of the arguments in the output string. The examples on this page does not mention this feature at all. Does C++20 std::format() allows reordering or not? --2003:E3:B71E:EF00:FD3E:72FF:AAAE:2B48 02:29, 1 June 2022 (PDT)

It does, see arg-id in the format string specification in format() et al --Ybab321 (talk) 02:54, 1 June 2022 (PDT)

constexpr required for formatter<T, Char>::parse()?

While trying to implement a formatter, I noticed that both MSVC and GCC require making formatter::parse() constexpr (when used within std::format); otherwise the code doesn't compile (code on Coliru). MSVC STL (example) and GCC libc++ (example) also make their formatter::parse()s constexpr. So I think there is some sort of requirement about this; but I can't find evidence, and I don't really know much about this. Studyingegret (talk) 04:53, 8 November 2023 (PST)