doc extension concerning format_as and general implementations (#4857)

This commit is contained in:
rimathia 2026-07-29 18:43:31 +02:00 committed by GitHub
parent 26c01df3bd
commit 17500e457b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -92,6 +92,10 @@ 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 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. 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. It should be defined in the same namespace as your type.
`format_as` cannot be used when a type also matches another `formatter`
specialization, such as the range `formatter`, because the specializations
would be ambiguous. Disable the conflicting specialization, if possible,
or provide an explicit `formatter` specialization instead.
Example ([run](https://godbolt.org/z/nvME4arz8)): Example ([run](https://godbolt.org/z/nvME4arz8)):