Skip to content

Improve array generation in array_from_delimited_string #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

rsore
Copy link
Owner

@rsore rsore commented Oct 14, 2024

Very small, isolated change. Simply attempts to make the segmentation of string_views in array_from_delimited_string more readable. The lambda passed to std::ranges::transform has been updated, and now looks like:

std::ranges::transform(std::views::split(strv, delimiter),
                       result.begin(),
                       [](const auto &segment) -> std::string_view
                       {
                           const auto length = static_cast<std::size_t>(std::ranges::distance(segment));
                           return {segment.begin(), length};
                       });

@rsore rsore added the improvement Improvement to existing feature label Oct 14, 2024
Copy link

clang-tidy review says "All clean, LGTM! 👍"

@rsore rsore merged commit 4623104 into main Oct 14, 2024
5 checks passed
@rsore rsore deleted the improve-array-generation branch October 14, 2024 20:59
rsore added a commit that referenced this pull request Oct 20, 2024
Improve array generation in array_from_delimited_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement to existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant