| 1 |
template <typename T, typename Promise> |
| 2 |
inline RecGenIterator<T, Promise>::RecGenIterator(Promise* promise) noexcept |
| 3 |
: |
| 4 |
d_promise(promise) |
| 5 |
{} |
| 6 |
|
| 7 |
template <typename T, typename Promise> |
| 8 |
inline bool RecGenIterator<T, Promise>:: |
| 9 |
operator==(RecGenIterator const &other) const noexcept |
| 10 |
{ |
| 11 |
return d_promise == other.d_promise; |
| 12 |
} |
| 13 |
|
| 14 |
template <typename T, typename Promise> |
| 15 |
inline bool RecGenIterator<T, Promise>::operator!=( |
| 16 |
RecGenIterator const &other) const noexcept |
| 17 |
{ |
| 18 |
return d_promise != other.d_promise; |
| 19 |
} |
| 20 |
|
| 21 |
template <typename T, typename Promise> |
| 22 |
RecGenIterator<T, Promise> &RecGenIterator<T, Promise>::operator++() |
| 23 |
{ |
| 24 |
d_promise->pull(); |
| 25 |
if (d_promise->is_complete()) |
| 26 |
{ |
| 27 |
auto *temp = d_promise; |
| 28 |
d_promise = nullptr; |
| 29 |
temp->throw_if_exception(); |
| 30 |
} |
| 31 |
|
| 32 |
return *this; |
| 33 |
} |
| 34 |
|
| 35 |
template <typename T, typename Promise> |
| 36 |
void RecGenIterator<T, Promise>:: operator++(int) |
| 37 |
{ |
| 38 |
operator++(); |
| 39 |
} |
| 40 |
|
| 41 |
template <typename T, typename Promise> |
| 42 |
inline typename RecGenIterator<T, Promise>::Reference |
| 43 |
RecGenIterator<T, Promise>::operator*() const noexcept |
| 44 |
{ |
| 45 |
return static_cast<Reference>(d_promise->value()); |
| 46 |
} |
| 47 |
|
| 48 |
template <typename T, typename Promise> |
| 49 |
inline T *RecGenIterator<T, Promise>::operator->() const noexcept |
| 50 |
{ |
| 51 |
return std::addressof(operator*()); |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|