C++ Channel
|
An iterator that block the current thread, waiting to fetch elements from the channel. More...
#include <blocking_iterator.hpp>
Public Types | |
using | value_type = typename Channel::value_type |
The type of the elements stored in the channel. | |
using | reference = const typename Channel::value_type & |
Constant reference to the type of the elements stored in the channel. | |
using | iterator_category = std::input_iterator_tag |
Supporting single-pass reading of elements. | |
using | difference_type = std::ptrdiff_t |
Signed integral type for iterator difference. | |
using | pointer = const value_type * |
Pointer type to the value_type. | |
Public Member Functions | |
blocking_iterator (Channel &chan) | |
Constructs a blocking iterator from a channel reference. | |
blocking_iterator< Channel > | operator++ () const noexcept |
Advances the iterator to the next element. | |
reference | operator* () |
Retrieves and returns the next element from the channel. | |
bool | operator!= (blocking_iterator< Channel >) const |
Makes iteration continue until the channel is closed and empty. | |
An iterator that block the current thread, waiting to fetch elements from the channel.
Used to implement channel range-based for loop.
Channel | Instance of channel. |
|
inlineexplicit |
Constructs a blocking iterator from a channel reference.
chan | Reference to the channel this iterator will iterate over. |
|
inline |
Makes iteration continue until the channel is closed and empty.
|
inline |
Retrieves and returns the next element from the channel.
|
inlinenoexcept |
Advances the iterator to the next element.