Processing Containers

This section discusses how to process several containers and the same time using the example of separate containers of indices.

Processing Several Containers at a Time

When using parallel algorithms, you might sometimes want to access other containers.

For example, you might want to execute for_each o​n two containers.

The main technique is to get the index of the element currently being processed. Then you can use that index to access other containers (assuming the containers are of the same size).

We can do it in a few ways:

  • by using a separate container of indices
  • by using zip iterators/wrappers

Let’s have a look at these techniques.

Separate container of indices

Get hands-on with 1400+ tech skills courses.