-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathiterator.h
More file actions
41 lines (30 loc) · 765 Bytes
/
Copy pathiterator.h
File metadata and controls
41 lines (30 loc) · 765 Bytes
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
//
// Created by 赵健 on 2021/8/17.
//
#ifndef ANDROIDHELPER_ITERATOR_H
#define ANDROIDHELPER_ITERATOR_H
#include "Node.h"
class iterator {
Node *pt;
public:
iterator() : pt(nullptr) {}
iterator(Node *pn) : pt(pn) {}
double operator*() { return pt->item; }
iterator &operator++() { // for ++it
pt = pt->p_next;
return *this;
}
iterator operator++(int) { // for it++
iterator tmp = *this;
pt = pt->p_next;
return tmp;
}
// iterator find_ll(iterator head, const double &val) {
// iterator start;
// for (start = head; start != 0; ++start) {
// if (*start == val) return start;
// }
// return 0;
// }
};
#endif //ANDROIDHELPER_ITERATOR_H