A helper class to divide a range into blocks. Used by parallelize_loop() and push_loop().
More...
#include <BS_thread_pool.hpp>
|
| blocks (const T1 first_index_, const T2 index_after_last_, const size_t num_blocks_) |
| Construct a blocks object with the given specifications. More...
|
|
T | start (const size_t i) const |
| Get the first index of a block. More...
|
|
T | end (const size_t i) const |
| Get the index after the last index of a block. More...
|
|
size_t | get_num_blocks () const |
| Get the number of blocks. Note that this may be different than the desired number of blocks that was passed to the constructor. More...
|
|
size_t | get_total_size () const |
| Get the total number of indices in the range. More...
|
|
template<typename T1, typename T2, typename T = std::common_type_t<T1, T2>>
class BS::blocks< T1, T2, T >
A helper class to divide a range into blocks. Used by parallelize_loop() and push_loop().
- Template Parameters
-
T1 | The type of the first index in the range. Should be a signed or unsigned integer. |
T2 | The type of the index after the last index in the range. Should be a signed or unsigned integer. If T1 is not the same as T2, a common type will be automatically inferred. |
T | The common type of T1 and T2. |
◆ blocks()
blocks |
( |
const T1 |
first_index_, |
|
|
const T2 |
index_after_last_, |
|
|
const size_t |
num_blocks_ |
|
) |
| |
|
inline |
Construct a blocks object with the given specifications.
- Parameters
-
first_index_ | The first index in the range. |
index_after_last_ | The index after the last index in the range. |
num_blocks_ | The desired number of blocks to divide the range into. |
◆ end()
T end |
( |
const size_t |
i | ) |
const |
|
inline |
Get the index after the last index of a block.
- Parameters
-
- Returns
- The index after the last index.
◆ get_num_blocks()
size_t get_num_blocks |
( |
| ) |
const |
|
inline |
Get the number of blocks. Note that this may be different than the desired number of blocks that was passed to the constructor.
- Returns
- The number of blocks.
◆ get_total_size()
size_t get_total_size |
( |
| ) |
const |
|
inline |
Get the total number of indices in the range.
- Returns
- The total number of indices.
◆ start()
T start |
( |
const size_t |
i | ) |
const |
|
inline |
Get the first index of a block.
- Parameters
-
- Returns
- The first index.
The documentation for this class was generated from the following file: