El 04/11/2025 a las 20:07, Mungo Gill via Boost escribió:
In case anyone is curious how to implement support for <format> in boost::string_view by delegating to the formatter for std::string_view: https://godbolt.org/z/YsWKrEz3P
I really don't like when the standard requires specializing std types to plug user-defined types in the system. That makes your type dependent on types and includes users might not need at all. Having to specialize std::formatter is an arbitraty decision that increases coupling. The alternative could be to have typedef of name "std_formatter_t" that could do the same work. I prefer the approach of defining some member functions, operations or typedefs that the standard library must find in your type, e.g.: having "operator < in your type" instead of a specializing std::less. Define "hash_value" instead of specializing "std::hash". Best, Ion