tcbrindle / flux

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

Add adjacent_filter adaptor #119

Closed tcbrindle closed 1 year ago

tcbrindle commented 1 year ago

adjacent_filter() takes a binary predicate and has the same semantics as Range-V3's views::adjacent_filter: elements are tested pair-wise, and if the predicate returns false then the second element of the pair is discarded.

This also adds dedup() as a shortcut for adjacent_filter(std::not_equal_to{}), because that's what people are probably going to want most of the time.

Fixes #116

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (979cb60) 97.58% compared to head (cf4ff91) 97.58%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #119 +/- ## ======================================= Coverage 97.58% 97.58% ======================================= Files 66 66 Lines 2280 2280 ======================================= Hits 2225 2225 Misses 55 55 ``` | [Files Changed](https://app.codecov.io/gh/tcbrindle/flux/pull/119?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tristan+Brindle) | Coverage Δ | | |---|---|---| | [include/flux/core/inline\_sequence\_base.hpp](https://app.codecov.io/gh/tcbrindle/flux/pull/119?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tristan+Brindle#diff-aW5jbHVkZS9mbHV4L2NvcmUvaW5saW5lX3NlcXVlbmNlX2Jhc2UuaHBw) | `91.66% <ø> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.