|
2201 | 2201 | \begin{example}
|
2202 | 2202 | \begin{codeblock}
|
2203 | 2203 | template<bool YieldElements>
|
2204 |
| -std::generator<any> f(std::ranges::@\libconcept{input_range}@ auto&& r) { |
| 2204 | +generator<any> f(ranges::@\libconcept{input_range}@ auto&& r) { |
2205 | 2205 | if constexpr (YieldElements)
|
2206 |
| - co_yield std::ranges::elements_of(r); // yield each element of \tcode{r} |
| 2206 | + co_yield ranges::elements_of(r); // yield each element of \tcode{r} |
2207 | 2207 | else
|
2208 |
| - co_yield r; // yield \tcode{r} as a single value |
| 2208 | + co_yield r; // yield \tcode{r} as a single value |
2209 | 2209 | }
|
2210 | 2210 | \end{codeblock}
|
2211 | 2211 | \end{example}
|
|
3825 | 3825 | \begin{example}
|
3826 | 3826 | \begin{codeblock}
|
3827 | 3827 | auto ints = istringstream{"0 1 2 3 4"};
|
3828 |
| -ranges::copy(ranges::istream_view<int>(ints), ostream_iterator<int>{cout, "-"}); |
| 3828 | +ranges::copy(views::istream<int>(ints), ostream_iterator<int>{cout, "-"}); |
3829 | 3829 | // prints \tcode{0-1-2-3-4-}
|
3830 | 3830 | \end{codeblock}
|
3831 | 3831 | \end{example}
|
|
5919 | 5919 | \begin{codeblock}
|
5920 | 5920 | auto input = istringstream{"0 1 2 3 4 5 6 7 8 9"};
|
5921 | 5921 | auto small = [](const auto x) noexcept { return x < 5; };
|
5922 |
| -auto small_ints = istream_view<int>(input) | views::take_while(small); |
| 5922 | +auto small_ints = views::istream<int>(input) | views::take_while(small); |
5923 | 5923 | for (const auto i : small_ints) {
|
5924 | 5924 | cout << i << ' '; // prints \tcode{0 1 2 3 4}
|
5925 | 5925 | }
|
|
14251 | 14251 | \pnum
|
14252 | 14252 | \begin{example}
|
14253 | 14253 | \begin{codeblock}
|
14254 |
| -std::vector<int> v { 0, 1, 2 }; |
| 14254 | +vector<int> v { 0, 1, 2 }; |
14255 | 14255 | for (auto&& [a, b, c] : views::cartesian_product(v, v, v)) {
|
14256 |
| - std::cout << a << ' ' << b << ' ' << c << '\n'; |
| 14256 | + cout << a << ' ' << b << ' ' << c << '\n'; |
14257 | 14257 | }
|
14258 | 14258 | // The above prints
|
14259 | 14259 | // \tcode{0 0 0}
|
@@ -15003,14 +15003,14 @@
|
15003 | 15003 | is successively produced as an element of the sequence.
|
15004 | 15004 | \begin{example}
|
15005 | 15005 | \begin{codeblock}
|
15006 |
| -std::generator<int> ints(int start = 0) { |
| 15006 | +generator<int> ints(int start = 0) { |
15007 | 15007 | while (true)
|
15008 | 15008 | co_yield start++;
|
15009 | 15009 | }
|
15010 | 15010 |
|
15011 | 15011 | void f() {
|
15012 |
| - for (auto i : ints() | std::views::take(3)) |
15013 |
| - std::cout << i << ' '; // prints \tcode{0 1 2} |
| 15012 | + for (auto i : ints() | views::take(3)) |
| 15013 | + cout << i << ' '; // prints \tcode{0 1 2} |
15014 | 15014 | }
|
15015 | 15015 | \end{codeblock}
|
15016 | 15016 | \end{example}
|
|
0 commit comments