185 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LIBCPP_TEST_STD_ITERATORS_ITERATOR_REQUIREMENTS_ITERATOR_CONCEPTS_INCREMENTABLE_H10#define LIBCPP_TEST_STD_ITERATORS_ITERATOR_REQUIREMENTS_ITERATOR_CONCEPTS_INCREMENTABLE_H11 12struct postfix_increment_returns_void {13 using difference_type = int;14 postfix_increment_returns_void& operator++();15 void operator++(int);16};17 18struct postfix_increment_returns_copy {19 using difference_type = int;20 postfix_increment_returns_copy& operator++();21 postfix_increment_returns_copy operator++(int);22};23 24struct has_integral_minus {25 has_integral_minus& operator++();26 has_integral_minus operator++(int);27 28 long operator-(has_integral_minus) const;29};30 31struct has_distinct_difference_type_and_minus {32 using difference_type = short;33 34 has_distinct_difference_type_and_minus& operator++();35 has_distinct_difference_type_and_minus operator++(int);36 37 long operator-(has_distinct_difference_type_and_minus) const;38};39 40struct missing_difference_type {41 missing_difference_type& operator++();42 void operator++(int);43};44 45struct floating_difference_type {46 using difference_type = float;47 48 floating_difference_type& operator++();49 void operator++(int);50};51 52struct non_const_minus {53 non_const_minus& operator++();54 non_const_minus operator++(int);55 56 long operator-(non_const_minus);57};58 59struct non_integral_minus {60 non_integral_minus& operator++();61 non_integral_minus operator++(int);62 63 void operator-(non_integral_minus);64};65 66struct bad_difference_type_good_minus {67 using difference_type = float;68 69 bad_difference_type_good_minus& operator++();70 void operator++(int);71 72 int operator-(bad_difference_type_good_minus) const;73};74 75struct not_default_initializable {76 using difference_type = int;77 not_default_initializable() = delete;78 79 not_default_initializable& operator++();80 void operator++(int);81};82 83struct not_movable {84 using difference_type = int;85 86 not_movable() = default;87 not_movable(not_movable&&) = delete;88 89 not_movable& operator++();90 void operator++(int);91};92 93struct preinc_not_declared {94 using difference_type = int;95 96 void operator++(int);97};98 99struct postinc_not_declared {100 using difference_type = int;101 102 postinc_not_declared& operator++();103};104 105struct incrementable_with_difference_type {106 using difference_type = int;107 108 incrementable_with_difference_type& operator++();109 incrementable_with_difference_type operator++(int);110 111 bool operator==(incrementable_with_difference_type const&) const;112};113 114struct incrementable_without_difference_type {115 incrementable_without_difference_type& operator++();116 incrementable_without_difference_type operator++(int);117 118 bool operator==(incrementable_without_difference_type const&) const;119 120 int operator-(incrementable_without_difference_type) const;121};122 123struct difference_type_and_void_minus {124 using difference_type = int;125 126 difference_type_and_void_minus& operator++();127 difference_type_and_void_minus operator++(int);128 129 bool operator==(difference_type_and_void_minus const&) const;130 131 void operator-(difference_type_and_void_minus) const;132};133 134struct noncopyable_with_difference_type {135 using difference_type = int;136 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;140 141 noncopyable_with_difference_type& operator=(noncopyable_with_difference_type&&) = default;142 noncopyable_with_difference_type& operator=(noncopyable_with_difference_type const&) = delete;143 144 noncopyable_with_difference_type& operator++();145 noncopyable_with_difference_type operator++(int);146 147 bool operator==(noncopyable_with_difference_type const&) const;148};149 150struct 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;154 155 noncopyable_without_difference_type& operator=(noncopyable_without_difference_type&&) = default;156 noncopyable_without_difference_type& operator=(noncopyable_without_difference_type const&) = delete;157 158 noncopyable_without_difference_type& operator++();159 noncopyable_without_difference_type operator++(int);160 161 int operator-(noncopyable_without_difference_type const&) const;162 163 bool operator==(noncopyable_without_difference_type const&) const;164};165 166struct noncopyable_with_difference_type_and_minus {167 using difference_type = int;168 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;172 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;175 176 noncopyable_with_difference_type_and_minus& operator++();177 noncopyable_with_difference_type_and_minus operator++(int);178 179 int operator-(noncopyable_with_difference_type_and_minus const&) const;180 181 bool operator==(noncopyable_with_difference_type_and_minus const&) const;182};183 184#endif // #define LIBCPP_TEST_STD_ITERATORS_ITERATOR_REQUIREMENTS_ITERATOR_CONCEPTS_INCREMENTABLE_H185