Parallel Iteration
The types const_range_type and range_type model the Range Concept and provide methods to access the bounds of the range, as shown in Table 5-5. 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_hash_map.
Table 5-5. Concept for concurrent_hash_map range R
|
Pseudosignature |
Semantics |
|---|---|
|
|
First item in range |
|
|
One past last item in range |
-
const_range_type range( size_t grainsize ) const Effects: constructs a
const_range_typerepresenting all keys in the table. Thegrainsizeparameter is in units of hash table slots. Each slot typically has only one key-value pair.Returns: a
const_range_typeobject for the table.-
range_type range( size_t grainsize ) Returns: like
const_range_type, but returns arange_typeobject for the table.
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