From 897e394b925037fb2514759daa9d4809d763135f Mon Sep 17 00:00:00 2001 From: rimathia Date: Fri, 17 Jul 2026 20:42:02 +0200 Subject: [PATCH] add a sentence about the possible interaction of format_as and general implementations, correct one internal link --- doc/api.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api.md b/doc/api.md index ff190383..af66356d 100644 --- a/doc/api.md +++ b/doc/api.md @@ -92,6 +92,9 @@ Use `format_as` if you want to make your type formattable as some other type with the same format specifiers. The `format_as` function should take an object of your type and return an object of a formattable type. It should be defined in the same namespace as your type. +Note that `format_as` is not suitable for user-defined types which are already +formattable due to one of the general implementations (e.g. in +[`fmt/ranges.h`](#ranges-api)), specialize `formatter` explicitly in these cases. Example ([run](https://godbolt.org/z/nvME4arz8)): @@ -472,7 +475,7 @@ Using `fmt::join`, you can separate tuple elements with a custom separator: - [`std::tm`](https://en.cppreference.com/w/cpp/chrono/c/tm) The format syntax is described in [Chrono Format Specifications](syntax.md# -chrono-format-specifications). +chrono-format-spec). **Example**: