algorithm icon indicating copy to clipboard operation
algorithm copied to clipboard

Add `move_while` and `move_until` new algorithms

Open denzor200 opened this issue 3 years ago • 3 comments

Hello, i have an interest to be contributor of this library. I decided to start with this small PR to get experience and to receive feedback and "ping response" from community.

denzor200 avatar Oct 17 '22 14:10 denzor200

CI is broken, so this PR tested here: https://godbolt.org/z/b4vGMnK55

denzor200 avatar Oct 24 '22 21:10 denzor200

question: Forgive my ignorance - why not just use a std::move_iterator? What does this accomplish that that doesn't already do?

jgopel avatar Oct 24 '22 23:10 jgopel

why not just use a std::move_iterator?

I had same question for std::move, but it exists. Look:

std::move(v.begin(), v.end(), std::back_inserter(l));

does the same result as:

std::copy(std::make_move_iterator(v.begin()),
          std::make_move_iterator(v.end()),
          std::back_inserter(l));

What does this accomplish that that doesn't already do?

just readability, and those people who use boost::algorithm::copy_while and boost::algorithm::copy_until also need for move_while and move_until.

denzor200 avatar Oct 25 '22 11:10 denzor200