Skip to content

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

Merged
vitaut merged 3 commits into
fmtlib:masterfrom
brevzin:cpp20-only-ranges
Oct 16, 2021
Merged

vitaut merged 3 commits into
fmtlib:masterfrom
brevzin:cpp20-only-ranges

Conversation

@brevzin

@brevzin brevzin commented Oct 15, 2021

Copy link
Copy Markdown
Contributor

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

vitaut commented Oct 16, 2021

Copy link
Copy Markdown
Contributor

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.

2 participants