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 cycle() adaptor #71

Closed tcbrindle closed 1 year ago

tcbrindle commented 1 year ago

Given a multipass sequence, cycle(seq) is an infinite_sequence which endlessly yields the elements of seq, looping back to the beginning when the underlying sequence is exhausted.

To avoid "spooky action at a distance", cycle() only provides const access to the elements of the underlying sequence.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 98.36% and project coverage change: +0.04 :tada:

Comparison is base (471dd38) 97.70% compared to head (93a2936) 97.74%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #71 +/- ## ========================================== + Coverage 97.70% 97.74% +0.04% ========================================== Files 62 63 +1 Lines 2045 2132 +87 ========================================== + Hits 1998 2084 +86 - Misses 47 48 +1 ``` | [Impacted Files](https://app.codecov.io/gh/tcbrindle/flux/pull/71?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/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tristan+Brindle#diff-aW5jbHVkZS9mbHV4L2NvcmUvaW5saW5lX3NlcXVlbmNlX2Jhc2UuaHBw) | `91.42% <ø> (+0.51%)` | :arrow_up: | | [include/flux/op/cycle.hpp](https://app.codecov.io/gh/tcbrindle/flux/pull/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tristan+Brindle#diff-aW5jbHVkZS9mbHV4L29wL2N5Y2xlLmhwcA==) | `98.33% <98.33%> (ø)` | | | [include/flux/op/take.hpp](https://app.codecov.io/gh/tcbrindle/flux/pull/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tristan+Brindle#diff-aW5jbHVkZS9mbHV4L29wL3Rha2UuaHBw) | `100.00% <100.00%> (ø)` | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/tcbrindle/flux/pull/71/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.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.09 :tada:

Comparison is base (471dd38) 97.70% compared to head (f5fc8c6) 97.79%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #71 +/- ## ========================================== + Coverage 97.70% 97.79% +0.09% ========================================== Files 62 63 +1 Lines 2045 2132 +87 ========================================== + Hits 1998 2085 +87 Misses 47 47 ``` | [Impacted Files](https://app.codecov.io/gh/tcbrindle/flux/pull/71?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/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tristan+Brindle#diff-aW5jbHVkZS9mbHV4L2NvcmUvaW5saW5lX3NlcXVlbmNlX2Jhc2UuaHBw) | `91.42% <ø> (+0.51%)` | :arrow_up: | | [include/flux/op/cycle.hpp](https://app.codecov.io/gh/tcbrindle/flux/pull/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tristan+Brindle#diff-aW5jbHVkZS9mbHV4L29wL2N5Y2xlLmhwcA==) | `100.00% <100.00%> (ø)` | | | [include/flux/op/take.hpp](https://app.codecov.io/gh/tcbrindle/flux/pull/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tristan+Brindle#diff-aW5jbHVkZS9mbHV4L29wL3Rha2UuaHBw) | `100.00% <100.00%> (ø)` | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/tcbrindle/flux/pull/71/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.