Parallel Iteration
The types const_range_type and range_type model the Range Concept and provide the methods in Table 5-2 to access the bounds of the range. The types differ only in that the bounds for a const_range_type are of type const_iterator, whereas the bounds for a range_type are of type iterator.
Use the range types in conjunction with parallel_for, parallel_reduce, and parallel_scan to iterate over pairs in a concurrent_vector.
Table 5-2. Concept for concurrent_vector range R
|
Pseudosignature |
Semantics |
|---|---|
|
|
First item in range |
|
|
One past last item in range |
-
range_type range( size_t grainsize ) Returns: range over an entire
concurrent_vectorthat permits read-write access.-
const_range_type range( size_t grainsize ) const Returns: range over an entire
concurrent_vectorthat permits read-only access.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access