1 | #include <cstdio> |
2 | #include <ranges> |
3 | #include <string> |
4 | #include <vector> |
5 | |
6 | using string_vec = std::vector<std::string>; |
7 | |
8 | string_vec svec{"First" , "Second" , "Third" , "Fourth" }; |
9 | |
10 | struct Foo { |
11 | string_vec vec = svec; |
12 | }; |
13 | |
14 | int main() { |
15 | { |
16 | auto single = std::ranges::ref_view(svec[0]); |
17 | auto all = std::views::all(svec); |
18 | auto subset = all | std::views::take(2); |
19 | std::puts(s: "Break here" ); |
20 | } |
21 | |
22 | { |
23 | Foo f[2]; |
24 | auto view = std::ranges::ref_view(f); |
25 | std::puts(s: "Break here" ); |
26 | } |
27 | } |
28 | |