C++ 23 · Containers and algorithms
Chain lazy views
Filter and transform without creating intermediate containers (C++20).
auto squares = v | std::views::filter([](int n) { return n % 2 == 1; })
| std::views::transform([](int n) { return n * n; });
for (int n : squares) std::cout << n << ' ';