fmtlib / fmt

A modern formatting library
https://fmt.dev
Other
19.84k stars 2.42k forks source link

format_as support in fmt/core.h #3959

Closed cruisercoder closed 1 month ago

cruisercoder commented 1 month ago

format_as covers a large number of use cases where you need custom formatters but don't need custom format strings and you want a simpler function that can be next to the type's definition in it's namespace.

Even though the doc says I need fmt/format.h for custom formatters, I was able to include just fmt/core.h with specialization, but not with format_as. Could format_as be migrated to core without much impact?

vitaut commented 1 month ago

If you mean example in https://fmt.dev/latest/api.html#formatting-user-defined-types including fmt/format.h then it is only needed for fmt::underlying. format_as by itself doesn't require any {fmt} includes at all, you just map one formattable type to another.