1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LIBCPP_TEST_STD_ITERATORS_ITERATOR_REQUIREMENTS_ITERATOR_CONCEPTS_INCREMENTABLE_H
10 #define LIBCPP_TEST_STD_ITERATORS_ITERATOR_REQUIREMENTS_ITERATOR_CONCEPTS_INCREMENTABLE_H
12 struct postfix_increment_returns_void
{
13 using difference_type
= int;
14 postfix_increment_returns_void
& operator++();
18 struct postfix_increment_returns_copy
{
19 using difference_type
= int;
20 postfix_increment_returns_copy
& operator++();
21 postfix_increment_returns_copy
operator++(int);
24 struct has_integral_minus
{
25 has_integral_minus
& operator++();
26 has_integral_minus
operator++(int);
28 long operator-(has_integral_minus
) const;
31 struct has_distinct_difference_type_and_minus
{
32 using difference_type
= short;
34 has_distinct_difference_type_and_minus
& operator++();
35 has_distinct_difference_type_and_minus
operator++(int);
37 long operator-(has_distinct_difference_type_and_minus
) const;
40 struct missing_difference_type
{
41 missing_difference_type
& operator++();
45 struct floating_difference_type
{
46 using difference_type
= float;
48 floating_difference_type
& operator++();
52 struct non_const_minus
{
53 non_const_minus
& operator++();
54 non_const_minus
operator++(int);
56 long operator-(non_const_minus
);
59 struct non_integral_minus
{
60 non_integral_minus
& operator++();
61 non_integral_minus
operator++(int);
63 void operator-(non_integral_minus
);
66 struct bad_difference_type_good_minus
{
67 using difference_type
= float;
69 bad_difference_type_good_minus
& operator++();
72 int operator-(bad_difference_type_good_minus
) const;
75 struct not_default_initializable
{
76 using difference_type
= int;
77 not_default_initializable() = delete;
79 not_default_initializable
& operator++();
84 using difference_type
= int;
86 not_movable() = default;
87 not_movable(not_movable
&&) = delete;
89 not_movable
& operator++();
93 struct preinc_not_declared
{
94 using difference_type
= int;
99 struct postinc_not_declared
{
100 using difference_type
= int;
102 postinc_not_declared
& operator++();
105 struct incrementable_with_difference_type
{
106 using difference_type
= int;
108 incrementable_with_difference_type
& operator++();
109 incrementable_with_difference_type
operator++(int);
111 bool operator==(incrementable_with_difference_type
const&) const;
114 struct incrementable_without_difference_type
{
115 incrementable_without_difference_type
& operator++();
116 incrementable_without_difference_type
operator++(int);
118 bool operator==(incrementable_without_difference_type
const&) const;
120 int operator-(incrementable_without_difference_type
) const;
123 struct difference_type_and_void_minus
{
124 using difference_type
= int;
126 difference_type_and_void_minus
& operator++();
127 difference_type_and_void_minus
operator++(int);
129 bool operator==(difference_type_and_void_minus
const&) const;
131 void operator-(difference_type_and_void_minus
) const;
134 struct noncopyable_with_difference_type
{
135 using difference_type
= int;
137 noncopyable_with_difference_type() = default;
138 noncopyable_with_difference_type(noncopyable_with_difference_type
&&) = default;
139 noncopyable_with_difference_type(noncopyable_with_difference_type
const&) = delete;
141 noncopyable_with_difference_type
& operator=(noncopyable_with_difference_type
&&) = default;
142 noncopyable_with_difference_type
& operator=(noncopyable_with_difference_type
const&) = delete;
144 noncopyable_with_difference_type
& operator++();
145 noncopyable_with_difference_type
operator++(int);
147 bool operator==(noncopyable_with_difference_type
const&) const;
150 struct noncopyable_without_difference_type
{
151 noncopyable_without_difference_type() = default;
152 noncopyable_without_difference_type(noncopyable_without_difference_type
&&) = default;
153 noncopyable_without_difference_type(noncopyable_without_difference_type
const&) = delete;
155 noncopyable_without_difference_type
& operator=(noncopyable_without_difference_type
&&) = default;
156 noncopyable_without_difference_type
& operator=(noncopyable_without_difference_type
const&) = delete;
158 noncopyable_without_difference_type
& operator++();
159 noncopyable_without_difference_type
operator++(int);
161 int operator-(noncopyable_without_difference_type
const&) const;
163 bool operator==(noncopyable_without_difference_type
const&) const;
166 struct noncopyable_with_difference_type_and_minus
{
167 using difference_type
= int;
169 noncopyable_with_difference_type_and_minus() = default;
170 noncopyable_with_difference_type_and_minus(noncopyable_with_difference_type_and_minus
&&) = default;
171 noncopyable_with_difference_type_and_minus(noncopyable_with_difference_type_and_minus
const&) = delete;
173 noncopyable_with_difference_type_and_minus
& operator=(noncopyable_with_difference_type_and_minus
&&) = default;
174 noncopyable_with_difference_type_and_minus
& operator=(noncopyable_with_difference_type_and_minus
const&) = delete;
176 noncopyable_with_difference_type_and_minus
& operator++();
177 noncopyable_with_difference_type_and_minus
operator++(int);
179 int operator-(noncopyable_with_difference_type_and_minus
const&) const;
181 bool operator==(noncopyable_with_difference_type_and_minus
const&) const;
184 #endif // #define LIBCPP_TEST_STD_ITERATORS_ITERATOR_REQUIREMENTS_ITERATOR_CONCEPTS_INCREMENTABLE_H