Improve diagnostic to suggest fmt/ranges.h
The container support in fmt/ranges.h is extremely powerful, but I often forget that it exists. Could we have a specific error message in the event that we encounter an unformattable type that appears to be a range?
I think we could check if the type has begin / end and provide a better diagnostic in that case.
@vitaut I was taking a look at this
I believe we'd need to move the detail::is_range_ check from ranges.h to base.h (or format.h?). It only depends on the std header type_traits so includes don't change
These lines would move: https://github.com/fmtlib/fmt/blob/75e5be6adc294f5c7774b8b6ebbef1b1979fad86/include/fmt/ranges.h#L47-L114
And then have a SFINAE alternative if is_range_ is true to the generic error type at:
https://github.com/fmtlib/fmt/blob/75e5be6adc294f5c7774b8b6ebbef1b1979fad86/include/fmt/base.h#L2207-L2212
saying a similar error message plus "did you forget to include fmt/ranges.h?"
Does that sound acceptable to you?
Thinking more of it, this seems like a bad idea because it would create a weird special case for ranges which is only one of many standard formatters. It is also unnecessary with modules.
But thanks, @Arghnews, for looking into it anyway.