tcbrindle / NanoRange

Range-based goodness for C++17
Boost Software License 1.0
358 stars 28 forks source link

Add for_each_n.hpp #95

Closed al-mission-2016 closed 4 years ago

al-mission-2016 commented 4 years ago

Hi, Tristan. After P1243R4 ranges::for_each_n (as well as sample and clamp) was added into C++20. http://open-std.org/JTC1/SC22/WG21/docs/papers/2020/p1243r4.pdf http://eel.is/c++draft/alg.foreach

tcbrindle commented 4 years ago

Hi, thanks for the PR!

A couple of comments/requested changes:

See uninitialized_fill_n for an example of what I'm after.

Also, importantly, please add tests. Contrary to the above, these should go in their own test/algorithm/for_each_n.cpp source file. Range-V3 has a test file here which you can adapt for NanoRange (but please make sure to keep the copyright/licence notice intact, of course).

tcbrindle commented 4 years ago

Implemented in #96