Skip to content

Commit

Permalink
👷 conf-window: refactor for_each into views
Browse files Browse the repository at this point in the history
  • Loading branch information
vnepogodin committed Aug 15, 2024
1 parent 9bb3e77 commit 5cb599a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/conf-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ bool insert_new_source_array_into_pkgbuild(std::string_view kernel_name_path, QL
return !rng_str.ends_with(".patch");
};

std::vector<std::string> array_entries{};
std::ranges::for_each(orig_source_array | std::ranges::views::filter(functor), [&](auto&& rng) { array_entries.emplace_back(fmt::format(FMT_COMPILE("\"{}\""), rng)); });
auto array_entries = orig_source_array
| std::ranges::views::filter(functor)
| std::ranges::views::transform([](auto&& rng) { return fmt::format(FMT_COMPILE("\"{}\""), rng); })
| std::ranges::to<std::vector<std::string>>();

// Apply flag to each item in list widget
for (int i = 0; i < list_widget->count(); ++i) {
Expand Down

0 comments on commit 5cb599a

Please sign in to comment.