Skip to content

Commit bfa515a

Browse files
committed
Modernize range-v3 code example
1 parent 8d60a41 commit bfa515a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,11 @@ const auto result_fplus = fwd::apply(
332332
// range-v3
333333
const auto result_range_v3 =
334334
accumulate(
335-
view::ints(0)
336-
| view::take(15000000)
337-
| view::transform(times_3)
338-
| view::remove_if(is_odd_int)
339-
| view::transform(as_string_length)
340-
, 0);
335+
views::ints(0, ranges::unreachable)
336+
| views::take(15000000)
337+
| views::transform(times_3)
338+
| views::remove_if(is_odd_int)
339+
| views::transform(as_string_length), 0);
341340
```
342341
343342
There are some differences though. Range-v3 ranges are lazy, which means no intermediate memory is allocated during the single steps of a processing chain like the above.

0 commit comments

Comments
 (0)