Range, vaguely a la Intel TBB, to encapsulate a random-access, STL-like start and end iterator with chunksize.
More...
#include <range.h>
|
| using | iterator = iteratorT |
| | Alias for the iterator type.
|
|
| | Range (const iterator &start, const iterator &finish, int chunk=1) |
| | Makes the range [start, finish).
|
| | Range (const Range &r) |
| | Copy constructor. Cost is O(1).
|
| | Range (Range &left, const Split &) |
| | Splits range between new and old (r) objects. Cost is O(1).
|
| const iterator & | begin () const |
| | Access the beginning.
|
| bool | empty () const |
| | Returns true if size == 0.
|
| const iterator & | end () const |
| | Access the end.
|
| unsigned int | get_chunksize () const |
| | Access the chunk size.
|
| bool | is_divisible () const |
| | Return true if this iteration range can be divided; that is, there are more items than the chunk size.
|
| size_t | size () const |
| | Returns the number of items in the range (cost is O(1)).
|
|
| template<typename integralT, typename distanceT> |
| static std::enable_if< std::is_integral< integralT >::value, void >::type | advance (integralT &i, distanceT n) |
| | Advance by n elements in the range.
|
| template<typename iterT, typename distanceT> |
| static std::enable_if<!std::is_integral< iterT >::value, void >::type | advance (iterT &it, distanceT n) |
| | Advance by n elements in the range.
|
| template<class integralT> |
| static std::enable_if< std::is_integral< integralT >::value, integralT >::type | distance (integralT first, integralT last) |
| | Calculate the distance between two iterators.
|
| template<class iterT> |
| static auto | distance (iterT first, iterT last, typename std::enable_if<!std::is_integral< iterT >::value >::type *=nullptr) -> decltype(std::distance(first, last)) |
| | Calculate the distance between two iterators.
|
|
| int | chunksize |
| | Number of items to give to each thread/process.
|
| iteratorT | finish |
| | Last item for iteration (first past the end, conventionally).
|
| long | n |
| | Number of items to iterator over.
|
| iteratorT | start |
| | First item for iteration.
|
template<typename iteratorT>
class madness::Range< iteratorT >
Range, vaguely a la Intel TBB, to encapsulate a random-access, STL-like start and end iterator with chunksize.
- Template Parameters
-
| iteratorT | The iterator type. |
◆ iterator
template<typename iteratorT>
Alias for the iterator type.
◆ Range() [1/3]
template<typename iteratorT>
Makes the range [start, finish).
The motivated reader should look at the Intel TBB range, partitioner, split, concepts, etc.
- Parameters
-
| [in] | start | The first item to iterate over. |
| [in] | finish | The last item for iteration (one past the end). |
| [in] | chunk | The number of items to give to each thread/process. |
◆ Range() [2/3]
template<typename iteratorT>
Copy constructor. Cost is O(1).
- Todo
- Can we make this = default?
- Parameters
-
◆ Range() [3/3]
template<typename iteratorT>
Splits range between new and old (r) objects. Cost is O(1).
- Parameters
-
| [in] | left | The range to be split. |
◆ advance() [1/2]
template<typename iteratorT>
template<typename integralT, typename distanceT>
Advance by n elements in the range.
This version is for cases where the "iterator type" is integral.
- Template Parameters
-
| integralT | The integral iterator type. |
| distanceT | The distance type. |
- Parameters
-
| [in,out] | i | The integral iterator. |
| [in] | n | The number of elements to advance. |
◆ advance() [2/2]
template<typename iteratorT>
template<typename iterT, typename distanceT>
Advance by n elements in the range.
This version is for cases where the "iterator type" is not integral.
- Template Parameters
-
| iterT | The non-integral iterator type. |
| distanceT | The distance type. |
- Parameters
-
| [in,out] | it | The iterator. |
| [in] | n | The number of elements to advance. |
◆ begin()
template<typename iteratorT>
Access the beginning.
- Returns
- Iterator to the first element.
◆ distance() [1/2]
template<typename iteratorT>
template<class integralT>
| std::enable_if< std::is_integral< integralT >::value, integralT >::type madness::Range< iteratorT >::distance |
( |
integralT | first, |
|
|
integralT | last ) |
|
inlinestaticprivate |
Calculate the distance between two iterators.
This version is for cases where the "iterator type" is integral.
- Template Parameters
-
| integralT | The integral iterator type. |
- Parameters
-
| [in] | first | One iterator. |
| [in] | last | The other iterator. |
- Returns
- The distance between the first and last iterators.
◆ distance() [2/2]
template<typename iteratorT>
template<class iterT>
Calculate the distance between two iterators.
This version is for cases where the "iterator type" is not integral.
- Template Parameters
-
| iterT | The non-integral iterator type. |
- Parameters
-
| [in] | first | One iterator. |
| [in] | last | The other iterator. |
- Returns
- The distance between the first and last iterators.
◆ empty()
template<typename iteratorT>
Returns true if size == 0.
- Returns
- True if size == 0.
◆ end()
template<typename iteratorT>
Access the end.
- Returns
- Iterator to the last element (one past the end).
◆ get_chunksize()
template<typename iteratorT>
Access the chunk size.
- Todo
- Should this return long, or size_t?
- Returns
- The chunk size.
◆ is_divisible()
template<typename iteratorT>
Return true if this iteration range can be divided; that is, there are more items than the chunk size.
- Returns
- True if this range can be divided.
◆ size()
template<typename iteratorT>
Returns the number of items in the range (cost is O(1)).
- Returns
- The number of items in the range.
◆ chunksize
template<typename iteratorT>
Number of items to give to each thread/process.
◆ finish
template<typename iteratorT>
Last item for iteration (first past the end, conventionally).
template<typename iteratorT>
◆ start
template<typename iteratorT>
First item for iteration.
The documentation for this class was generated from the following file: