From eb44d87b523f09e69f2fdc3e9593ade5c254160c Mon Sep 17 00:00:00 2001 From: Peter Steneteg Date: Tue, 7 Oct 2025 20:34:00 +0200 Subject: [PATCH] docs: range formatter grammar fix (#4567) --- doc/syntax.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/syntax.md b/doc/syntax.md index 46d7d2fd..b628a56f 100644 --- a/doc/syntax.md +++ b/doc/syntax.md @@ -718,7 +718,7 @@ These modifiers are only supported for the `'H'`, `'I'`, `'M'`, `'S'`, `'U'`, Format specifications for range types have the following syntax:
range_format_spec ::= ["n"][range_type][range_underlying_spec]
+>range_format_spec ::= ["n"][range_type][":" range_underlying_spec]
 
The `'n'` option formats the range without the opening and closing brackets. @@ -761,6 +761,8 @@ fmt::print("{::}", std::vector{'h', 'e', 'l', 'l', 'o'}); // Output: [h, e, l, l, o] fmt::print("{::d}", std::vector{'h', 'e', 'l', 'l', 'o'}); // Output: [104, 101, 108, 108, 111] +fmt::print("{:n:f}", std::array{std::numbers::pi, std::numbers::e}); +// Output: 3.141593, 2.718282 ``` ## Format Examples