Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable range formatter when user provides one #3961

Closed

Conversation

Arghnews
Copy link
Contributor

@Arghnews Arghnews commented May 15, 2024

Disable formatting type as range if user provided format_as function exists, using that instead. Should fix issue raised in #3839 by @drouhard

Edit: ah, this will need a similar workaround to detail::is_formattable_delayed for old msvc versions, before it will pass all the CI tests

Disable formatting type as range if user provided format_as function
exists, using that instead. Should fix issue raised in fmtlib#3839
@Arghnews Arghnews force-pushed the prefer_user_formatter_to_range branch from 414401a to 9d848ee Compare May 15, 2024 02:47
@vitaut
Copy link
Contributor

vitaut commented May 15, 2024

Thanks for the PR but I don't think this will work for formatter specializations and having this just for format_as would be inconsistent. fmt::format and std::format already have an opt out mechanism for ranges.

@vitaut vitaut closed this May 15, 2024
@jdrouhard
Copy link

What is the opt-out mechanism for a type if I don't want to include <fmt/ranges.h> in the header where the type is defined?

@vitaut
Copy link
Contributor

vitaut commented May 18, 2024

You could probably forward declare is_range but I would recommend including <fmt/ranges.h> since you are effectively defining formatting for ranges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants