1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef LIBCPP_TEST_STD_ITERATORS_ITERATOR_REQUIREMENTS_ITERATOR_CONCEPTS_INCREMENTABLE_H
9 #define LIBCPP_TEST_STD_ITERATORS_ITERATOR_REQUIREMENTS_ITERATOR_CONCEPTS_INCREMENTABLE_H
10 
11 struct postfix_increment_returns_void {
12   using difference_type = int;
13   postfix_increment_returns_void& operator++();
14   void operator++(int);
15 };
16 
17 struct postfix_increment_returns_copy {
18   using difference_type = int;
19   postfix_increment_returns_copy& operator++();
20   postfix_increment_returns_copy operator++(int);
21 };
22 
23 struct has_integral_minus {
24   has_integral_minus& operator++();
25   has_integral_minus operator++(int);
26 
27   long operator-(has_integral_minus) const;
28 };
29 
30 struct has_distinct_difference_type_and_minus {
31   using difference_type = short;
32 
33   has_distinct_difference_type_and_minus& operator++();
34   has_distinct_difference_type_and_minus operator++(int);
35 
36   long operator-(has_distinct_difference_type_and_minus) const;
37 };
38 
39 struct missing_difference_type {
40   missing_difference_type& operator++();
41   void operator++(int);
42 };
43 
44 struct floating_difference_type {
45   using difference_type = float;
46 
47   floating_difference_type& operator++();
48   void operator++(int);
49 };
50 
51 struct non_const_minus {
52   non_const_minus& operator++();
53   non_const_minus operator++(int);
54 
55   long operator-(non_const_minus);
56 };
57 
58 struct non_integral_minus {
59   non_integral_minus& operator++();
60   non_integral_minus operator++(int);
61 
62   void operator-(non_integral_minus);
63 };
64 
65 struct bad_difference_type_good_minus {
66   using difference_type = float;
67 
68   bad_difference_type_good_minus& operator++();
69   void operator++(int);
70 
71   int operator-(bad_difference_type_good_minus) const;
72 };
73 
74 struct not_default_initializable {
75   using difference_type = int;
76   not_default_initializable() = delete;
77 
78   not_default_initializable& operator++();
79   void operator++(int);
80 };
81 
82 struct not_movable {
83   using difference_type = int;
84 
85   not_movable() = default;
86   not_movable(not_movable&&) = delete;
87 
88   not_movable& operator++();
89   void operator++(int);
90 };
91 
92 struct preinc_not_declared {
93   using difference_type = int;
94 
95   void operator++(int);
96 };
97 
98 struct postinc_not_declared {
99   using difference_type = int;
100 
101   postinc_not_declared& operator++();
102 };
103 
104 struct incrementable_with_difference_type {
105   using difference_type = int;
106 
107   incrementable_with_difference_type& operator++();
108   incrementable_with_difference_type operator++(int);
109 
110   bool operator==(incrementable_with_difference_type const&) const;
111 };
112 
113 struct incrementable_without_difference_type {
114   incrementable_without_difference_type& operator++();
115   incrementable_without_difference_type operator++(int);
116 
117   bool operator==(incrementable_without_difference_type const&) const;
118 
119   int operator-(incrementable_without_difference_type) const;
120 };
121 
122 struct difference_type_and_void_minus {
123   using difference_type = int;
124 
125   difference_type_and_void_minus& operator++();
126   difference_type_and_void_minus operator++(int);
127 
128   bool operator==(difference_type_and_void_minus const&) const;
129 
130   void operator-(difference_type_and_void_minus) const;
131 };
132 
133 struct noncopyable_with_difference_type {
134   using difference_type = int;
135 
136   noncopyable_with_difference_type() = default;
137   noncopyable_with_difference_type(noncopyable_with_difference_type&&) = default;
138   noncopyable_with_difference_type(noncopyable_with_difference_type const&) = delete;
139 
140   noncopyable_with_difference_type& operator=(noncopyable_with_difference_type&&) = default;
141   noncopyable_with_difference_type& operator=(noncopyable_with_difference_type const&) = delete;
142 
143   noncopyable_with_difference_type& operator++();
144   noncopyable_with_difference_type operator++(int);
145 
146   bool operator==(noncopyable_with_difference_type const&) const;
147 };
148 
149 struct noncopyable_without_difference_type {
150   noncopyable_without_difference_type() = default;
151   noncopyable_without_difference_type(noncopyable_without_difference_type&&) = default;
152   noncopyable_without_difference_type(noncopyable_without_difference_type const&) = delete;
153 
154   noncopyable_without_difference_type& operator=(noncopyable_without_difference_type&&) = default;
155   noncopyable_without_difference_type& operator=(noncopyable_without_difference_type const&) = delete;
156 
157   noncopyable_without_difference_type& operator++();
158   noncopyable_without_difference_type operator++(int);
159 
160   int operator-(noncopyable_without_difference_type const&) const;
161 
162   bool operator==(noncopyable_without_difference_type const&) const;
163 };
164 
165 struct noncopyable_with_difference_type_and_minus {
166   using difference_type = int;
167 
168   noncopyable_with_difference_type_and_minus() = default;
169   noncopyable_with_difference_type_and_minus(noncopyable_with_difference_type_and_minus&&) = default;
170   noncopyable_with_difference_type_and_minus(noncopyable_with_difference_type_and_minus const&) = delete;
171 
172   noncopyable_with_difference_type_and_minus& operator=(noncopyable_with_difference_type_and_minus&&) = default;
173   noncopyable_with_difference_type_and_minus& operator=(noncopyable_with_difference_type_and_minus const&) = delete;
174 
175   noncopyable_with_difference_type_and_minus& operator++();
176   noncopyable_with_difference_type_and_minus operator++(int);
177 
178   int operator-(noncopyable_with_difference_type_and_minus const&) const;
179 
180   bool operator==(noncopyable_with_difference_type_and_minus const&) const;
181 };
182 
183 #endif // #define LIBCPP_TEST_STD_ITERATORS_ITERATOR_REQUIREMENTS_ITERATOR_CONCEPTS_INCREMENTABLE_H
184