This repository was archived by the owner on Jan 23, 2023. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy pathiterator.h
144 lines (119 loc) · 2.91 KB
/
iterator.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma once
namespacejitstd
{
template <classCategory, classT, classDistance = ptrdiff_t, classPointer = T*, classReference = T&>
structiterator
{
typedef T value_type;
typedef Distance difference_type;
typedef Pointer pointer;
typedef Reference reference;
typedef Category iterator_category;
};
structinput_iterator_tag
{
};
structforward_iterator_tag : publicinput_iterator_tag
{
};
structbidirectional_iterator_tag : publicforward_iterator_tag
{
};
structrandom_access_iterator_tag : publicbidirectional_iterator_tag
{
};
structint_not_an_iterator_tag
{
};
template <typename Iterator>
structiterator_traits
{
typedeftypename Iterator::difference_type difference_type;
typedeftypename Iterator::value_type value_type;
typedeftypename Iterator::pointer pointer;
typedeftypename Iterator::reference reference;
typedeftypename Iterator::iterator_category iterator_category;
};
template <typename T>
structiterator_traits<T*>
{
typedefptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T& reference;
typedef random_access_iterator_tag iterator_category;
};
template <typename T>
structiterator_traits<const T*>
{
typedefptrdiff_t difference_type;
typedef T value_type;
typedefconst T* pointer;
typedefconst T& reference;
typedef random_access_iterator_tag iterator_category;
};
template<>
structiterator_traits<bool>
{
typedef int_not_an_iterator_tag iterator_category;
};
template<>
structiterator_traits<char>
{
typedef int_not_an_iterator_tag iterator_category;
};
template<>
structiterator_traits<signedchar>
{
typedef int_not_an_iterator_tag iterator_category;
};
template<>
structiterator_traits<unsignedchar>
{
typedef int_not_an_iterator_tag iterator_category;
};
template<>
structiterator_traits<short>
{
typedef int_not_an_iterator_tag iterator_category;
};
template<>
structiterator_traits<unsignedshort>
{
typedef int_not_an_iterator_tag iterator_category;
};
template<>
structiterator_traits<int>
{
typedef int_not_an_iterator_tag iterator_category;
};
template<>
structiterator_traits<unsignedint>
{
typedef int_not_an_iterator_tag iterator_category;
};
template<>
structiterator_traits<__int64>
{
typedef int_not_an_iterator_tag iterator_category;
};
template<>
structiterator_traits<unsigned __int64>
{
typedef int_not_an_iterator_tag iterator_category;
};
namespaceutil
{
template<classIterator>
inline
typename iterator_traits<Iterator>::iterator_category
iterator_category(const Iterator&)
{
typename iterator_traits<Iterator>::iterator_category categ;
return categ;
}
} // end of namespace util.
} // end of namespace jitstd.