
Episode 124: Vectorizing std::views::filter
Algorithms + Data Structures = Programs
00:00
How to Write a Range Adapter Function
This function called test ranges same arguments as before except now we have a variable local called ID access short for indexes and It is the composition of Iota starting at zero to going to n. Then that pipe to views filter with a predicate that's checking whether our value is greater than zero And after that we've got a range base for loop that Loops through each of the elements returned to us by indexes and sets each of those values to zero By using it as an index into our original array a Using the bracket operators Cool What would be a better way To write this using range adapters a way that would vectorize? You're being a little too clever because you're thinking you're thinking about
Transcript
Play full episode