tcbrindle / flux

A C++20 library for sequence-orientated programming
https://tristanbrindle.com/flux/
Boost Software License 1.0
476 stars 29 forks source link

Add documentation for drop adaptor #55

Closed jnytra closed 1 year ago

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (69d5d93) 98.37% compared to head (7fdede3) 98.38%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #55 +/- ## ======================================= Coverage 98.37% 98.38% ======================================= Files 63 63 Lines 2280 2287 +7 ======================================= + Hits 2243 2250 +7 Misses 37 37 ``` [see 2 files with indirect coverage changes](https://codecov.io/gh/tcbrindle/flux/pull/55/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tristan+Brindle)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

tcbrindle commented 1 year ago

Thanks for this!

It occurs to me that we should probably decide, and then document what happens if the user passes a negative value to drop(), and then I need to update the actual implementation to match the documented behaviour! (This also applies to take()).

We could either raise a runtime_error if the user passes a negative value, or else clamp the value to zero (so we don't actually drop anything). Currently I think the former is probably the way to go.

jnytra commented 1 year ago

Raise a runtime_error or invalid_argument if the user passes a negative value, sound good.

tcbrindle commented 1 year ago

Let me fix the drop and take adaptors so they match what we'd like them to do, then I can merge the documentation