Implement copy_if_while and copy_if_until#100
Conversation
tzlaine
left a comment
There was a problem hiding this comment.
@jgopel This needs documentation. The inline Doxygen comments are important, but you're missing the tutorial-level docs, like these: https://www.boost.org/doc/libs/1_79_0/libs/algorithm/doc/html/algorithm/Misc.html . See one of my PRs for how to add to the docs.
|
@tzlaine Thanks for the feedback Zach - I've added documentation using the existing documentation for The documentation that I have is certainly not as thorough as your documentation is on #47 or on #99. I viewed this as a tradeoff between consistency and thoroughness. In my experience, consistency in documentation is very important, so I decided to prioritize that over thoroughness. I could have had both consistency and thoroughness by updating the existing documentation to be more thorough, but that felt out of scope for this PR. If that's something that would be a welcome addition, I would be more than happy to address that in another PR! |
|
Docs LGTM. Marshall gets the final say, of course. |
| } | ||
|
|
||
| /// \fn copy_if_while ( InputIterator first, InputIterator last, OutputIterator result, CopyPredicate copy_pred, TerminatePred term_pred ) | ||
| /// \brief Copies all the elements from the input range that satisfy the |
There was a problem hiding this comment.
You missed something here; shouldn't this be:
Copies all the elements from the input range that satisfy the predicate while the termination predicate is satisfied.
also, is TerminatePred the correct term to use here?
There was a problem hiding this comment.
I fixed the missing documentation here.
There was a problem hiding this comment.
I'm not sure if TerminatePred is correct - I definitely struggled with naming of the predicates to indicate what they were and how they were different - these were the best that I could come up with. If you have a better name, I am more than happy to make changes!
mclow
left a comment
There was a problem hiding this comment.
This looks really good to me; just a couple bits of doxygen copy-pasta.
Sorry this took so long; my hand is healing very slowly
Problem: - There is no way to signal that a copy should proceed, selecting elements by a predicate until some condition is met. This is useful for patterns along the lines of "copy selected elements until there are n total elements in the output". Solution: - Introduce `copy_if_while()` and `copy_if_until()`.
Thanks for the feedback! I'm sorry to hear your hand is healing slowly 😞 No rush on responding to the one comment that I had - if you need to wait out the hand that's totally fine, I'll be here and be motivated when you're ready! |
Problem:
elements by a predicate until some condition is met. This is useful
for patterns along the lines of "copy selected elements until there
are n total elements in the output".
Solution:
copy_if_while()andcopy_if_until().