Код: Выделить всё
#include
#include
#include
using namespace std;
int main() {
// clang -std=c++20
std::vector input = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
auto output = input
| std::views::filter([](const int n) {return n % 3 == 0; })
| std::views::transform([](const int n) {return n * n; });
for (auto o : output) {
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/73195588/does-c20-ranges-have-any-view-functions-that-do-not-return-value[/url]