MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / main

Function main

03.14-rangesCommonView2/main.cpp:9–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <vector>
8
9int main()
10{
11 auto v = std::vector{3, 5, 6, 7, 9};
12 auto rng = v |
13 std::views::take_while([](int x) { return x > 5; })
14 // #A View with harmonized iterator types
15 | std::views::common;
16
17 auto res = std::accumulate(rng.begin(), rng.end(), 0);
18 std::cout << res << '\n';
19}

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected