Split range adaptors#10
Conversation
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
pre-commit
[pre-commit] reported by reviewdog 🐶
str_split/tests/beman/str_split/split_when.tests.cpp
Lines 58 to 60 in ba5f322
| } | ||
|
|
||
| TEST(Split, SplitsOnceOnSingleValue) { | ||
| auto name = "Alice's"sv; |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| auto name = "Alice's"sv; | |
| auto name = "Alice's"sv; |
| auto parts = "A"sv | ||
| | bss::views::split(""sv) | ||
| | std::ranges::to<std::vector<std::string>>(); |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| auto parts = "A"sv | |
| | bss::views::split(""sv) | |
| | std::ranges::to<std::vector<std::string>>(); | |
| auto parts = "A"sv | bss::views::split(""sv) | std::ranges::to<std::vector<std::string>>(); |
| auto parts = "Alice"sv | ||
| | bss::views::split(""sv) | ||
| | std::ranges::to<std::vector<std::string>>(); |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| auto parts = "Alice"sv | |
| | bss::views::split(""sv) | |
| | std::ranges::to<std::vector<std::string>>(); | |
| auto parts = "Alice"sv | bss::views::split(""sv) | std::ranges::to<std::vector<std::string>>(); |
| auto parts = "Down the Rabbit-Hole."sv | ||
| | bss::views::split("the"sv) | ||
| | std::ranges::to<std::vector<std::string>>(); |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| auto parts = "Down the Rabbit-Hole."sv | |
| | bss::views::split("the"sv) | |
| | std::ranges::to<std::vector<std::string>>(); | |
| auto parts = "Down the Rabbit-Hole."sv | bss::views::split("the"sv) | std::ranges::to<std::vector<std::string>>(); |
| auto parts = "Alice was beginning to get very tired"sv | ||
| | bss::views::split(" t"sv) | ||
| | std::ranges::to<std::vector<std::string>>(); |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| auto parts = "Alice was beginning to get very tired"sv | |
| | bss::views::split(" t"sv) | |
| | std::ranges::to<std::vector<std::string>>(); | |
| auto parts = "Alice was beginning to get very tired"sv | bss::views::split(" t"sv) | | |
| std::ranges::to<std::vector<std::string>>(); |
| V operator()(V view) | ||
| { | ||
| auto str = std::string_view(view); |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| V operator()(V view) | |
| { | |
| auto str = std::string_view(view); | |
| V operator()(V view) { | |
| auto str = std::string_view(view); |
| return {std::ranges::begin(view) + begin_pos, std::ranges::begin(view) + end_pos}; | ||
| } | ||
|
|
||
| private: |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| private: | |
| private: |
| std::string_view delimiters_; | ||
| }; | ||
|
|
||
| } |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| } | |
| } // namespace |
| auto words = ""sv | ||
| | bss::views::split_when(any_seq_of(" \t"sv)) | ||
| | std::ranges::to<std::vector<std::string>>(); |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| auto words = ""sv | |
| | bss::views::split_when(any_seq_of(" \t"sv)) | |
| | std::ranges::to<std::vector<std::string>>(); | |
| auto words = ""sv | bss::views::split_when(any_seq_of(" \t"sv)) | std::ranges::to<std::vector<std::string>>(); |
| auto parts = "Down the Rabbit-Hole"sv | ||
| | bss::views::split_when(any_seq_of("-."sv)) | ||
| | std::ranges::to<std::vector<std::string>>(); |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| auto parts = "Down the Rabbit-Hole"sv | |
| | bss::views::split_when(any_seq_of("-."sv)) | |
| | std::ranges::to<std::vector<std::string>>(); | |
| auto parts = "Down the Rabbit-Hole"sv | bss::views::split_when(any_seq_of("-."sv)) | | |
| std::ranges::to<std::vector<std::string>>(); |
Coverage Report for CI Build 27506021983Warning No base build found for commit Coverage: 96.226%Details
Uncovered Changes
Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
| auto words = "Alice \t was beginning to\tget \tvery tired"sv | ||
| | bss::views::split_when(any_seq_of(" \t"sv)) | ||
| | std::ranges::to<std::vector<std::string>>(); |
There was a problem hiding this comment.
[pre-commit] reported by reviewdog 🐶
| auto words = "Alice \t was beginning to\tget \tvery tired"sv | |
| | bss::views::split_when(any_seq_of(" \t"sv)) | |
| | std::ranges::to<std::vector<std::string>>(); | |
| auto words = "Alice \t was beginning to\tget \tvery tired"sv | bss::views::split_when(any_seq_of(" \t"sv)) | | |
| std::ranges::to<std::vector<std::string>>(); |
beman::str_split::split_when_viewis a range adaptor based onstd::ranges::split_viewthat splits a view on delimiters found by the provided search function. The search function takes the remaining sub-range to search as input, and returns the nested sub-range around the next delimiter.I've also implemented
std::range::split_viewasbeman::str_split::split_view. I haven't written range adaptors before, so this was a good learning exercise.beman::str_split::split_when_viewstill has all the same ergonomic issues thatstd::ranges::split_viewhas W.R.T working with strings. Nonetheless, I still think this is a useful starting point for range-based splitting.I've not made an attempt to use modules yet. Everything is header based. I do want to support modules, I just haven't take the time to learn how to use them.