Skip to content

Commit

Permalink
Merge pull request #34 from rsore/improve-array-generation
Browse files Browse the repository at this point in the history
Improve array generation in array_from_delimited_string
  • Loading branch information
rsore authored Oct 14, 2024
2 parents 81a58d5 + 61b0ac5 commit 4623104
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/CLArgs/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,11 @@ CLArgs::array_from_delimited_string()

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

return result;
}
Expand Down

0 comments on commit 4623104

Please sign in to comment.