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

Extending fmt::join to support C++20-only ranges. #2549

Merged
merged 3 commits into from
Oct 16, 2021

Conversation

brevzin
Copy link
Contributor

@brevzin brevzin commented Oct 15, 2021

The C++20 Ranges model means that you can have a type which is a C++20 range but not a C++17 range (an example of such is views::join on a range of prvalue ranges, or views::iota if the underlying type doesn't satisfy incrementable).

We just have to use std::iter_value_t<It> instead of going through std::iterator_traits directly (bonus, it's shorter, and no typename) and we have to not use *it++ and instead manually do *it and then ++it, since C++20 input iterators are allowed to have it++ be void.

@vitaut
Copy link
Contributor

vitaut commented Oct 16, 2021

Thanks for the PR. Looks good but please apply clang-format.

@vitaut vitaut merged commit 7aca36b into fmtlib:master Oct 16, 2021
@brevzin brevzin deleted the cpp20-only-ranges branch October 16, 2021 19:07
PoetaKodu pushed a commit to pacc-repo/fmt that referenced this pull request Nov 11, 2021
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.

None yet

2 participants