-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Implement ranges::replace #983
Conversation
e8f280f
to
1840a5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not yet compile as the algorithm has some additional constraints that are not fulfilled by the generic
with_input_range
Since this is passing now, I suspect you've realized that testing ranges with proxy references requires you to stick fairly closely to int
s or pair
s, or be prepared to add operations to test::proxy_reference
.
also the wording is really strange. It says that the algorithm shall return
last
which could actually be a sentinel. I believe it is indeed meant to return respective iterator but icky wording.
See [algorithms.requirements]/13, and read [algorithms.requirements]/12 while you're there. WG21 specifies algorithms in a DSL that resembles but is not C++ ;)
One style question for the maintainers. Do you prefer individual algorithm PRs like this here or should I open a single PR for e.g. all |
I think it's generally easier to review an entire family of algorithms in a single PR, since following a consistent pattern makes reviewing similar algorithms easier - then we just need to watch out for inconsistencies and (somewhat harder) watch out for places that should be different - neither of which is helped by splitting algorithms across PRs. Other maintainers may feel differently. It's not critically important for me. |
To ease review and reduce thenumber of concurrent PRs I have merged the other two remaining |
* Extract `with_output_iterators` from `with_writable_iterators` and implement `test_in_outerator` to instantiate with `input_range` and `output_iterator` types. * Pull `ranges::equal` out of `instantiator::call` in both `replace_copy` and `replace_copy_if` tests to avoid `/analyze` exhausting the compiler heap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will push changes to fix comment typos, otherwise looks great!
Thanks @miscco! You're irreplaceable. 😎 |
This implements the
ranges::replace
algorithm.@CaseyCarter: This does not yet compile as the algorithm has some additional constraints that are not fulfilled by the generic
with_input_range
The question is whether we want to specialize some
with_comparable_range
in the algorithm support header or simply special case it in the test. As that will most likely happen with other algorithms too I would like find a fitting solution that fits best for all algorithms.Also the wording is really strange. IT says that the algorithm shall return
last
which could actually be a sentinel. I believe it is indeed meant to return respective iterator but icky wording