-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP501.Facade.cpp
More file actions
35 lines (32 loc) · 1.08 KB
/
Copy pathP501.Facade.cpp
File metadata and controls
35 lines (32 loc) · 1.08 KB
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
#include <iostream>
#include <type_traits>
template<typename Derived, typename Value, typename Category, typename Reference = Value&, typename Distance = std::ptrdiff_t>
class IteratorFacade
{
public:
using value_type = std::remove_reference_t<Value>;
using reference = Reference;
using pointer = Value*;
using difference_type = Distance;
using iterator_category = Category;
// input iterator interface
reference operator*() const;
pointer operator->() const;
Derived& operator++();
Derived operator++(int);
...
// bidirectional iterator interface
Derived& operator--();
Derived operator--(int);
// random access iterator interface
reference operator[](difference_type n) const;
Derived& operator+=(difference_type n);
...
friend bool operator==(IteratorFacade& lhs, IteratorFacade& rhs);
friend difference_type operator-(const IteratorFacade& lhs, const IteratorFacade& rhs);
friend bool operator<(const IteratorFacade& lhs, const IteratorFacade& rhs);
};
int main(int argc, char const *argv[])
{
return 0;
}