File: recursiveiterator.imp

package info (click to toggle)
c%2B%2B-annotations 12.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,044 kB
  • sloc: cpp: 24,337; makefile: 1,517; ansic: 165; sh: 121; perl: 90
file content (56 lines) | stat: -rw-r--r-- 1,319 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
template <typename T, typename Promise>
inline RecGenIterator<T, Promise>::RecGenIterator(Promise* promise) noexcept
: 
    d_promise(promise)
{}

template <typename T, typename Promise>
inline bool RecGenIterator<T, Promise>::
operator==(RecGenIterator const &other) const noexcept
{
    return d_promise == other.d_promise;
}

template <typename T, typename Promise>
inline bool RecGenIterator<T, Promise>::operator!=(
                                RecGenIterator const &other) const noexcept
{
    return d_promise != other.d_promise;
}

template <typename T, typename Promise>
RecGenIterator<T, Promise> &RecGenIterator<T, Promise>::operator++()
{
    d_promise->pull();
    if (d_promise->is_complete())
    {
        auto *temp = d_promise;
        d_promise = nullptr;
        temp->throw_if_exception();
    }

    return *this;
}

template <typename T, typename Promise>
void RecGenIterator<T, Promise>:: operator++(int)
{
    operator++();
}

template <typename T, typename Promise>
inline typename RecGenIterator<T, Promise>::Reference 
RecGenIterator<T, Promise>::operator*() const noexcept
{
    return static_cast<Reference>(d_promise->value());
}

template <typename T, typename Promise>
inline T *RecGenIterator<T, Promise>::operator->() const noexcept
{
    return std::addressof(operator*());
}