Return the next element in the range if there is one. * * @param[out] next Will contain the next element if there is one. * * @return False if the end of the range has been reached and next wasn't set. */
| 64 | * @return False if the end of the range has been reached and next wasn't set. |
| 65 | */ |
| 66 | bool get_next(unsigned int &next) |
| 67 | { |
| 68 | next = atomic_fetch_add_explicit(&_atomic_counter, 1u, std::memory_order_relaxed); |
| 69 | return next < _end; |
| 70 | } |
| 71 | |
| 72 | private: |
| 73 | std::atomic_uint _atomic_counter; |