[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / libcxx / test / support / iterator_traits_cpp17_iterators.h
blob27856013cdb425ba2de48ec3c21555ea6a98f3ea
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 //===----------------------------------------------------------------------===//
9 #ifndef TEST_SUPPORT_ITERATOR_TRAITS_ITERATOR_TRAITS_CPP17_ITERATORS
10 #define TEST_SUPPORT_ITERATOR_TRAITS_ITERATOR_TRAITS_CPP17_ITERATORS
12 struct iterator_traits_cpp17_iterator {
13 int& operator*();
14 iterator_traits_cpp17_iterator& operator++();
15 iterator_traits_cpp17_iterator operator++(int);
18 struct iterator_traits_cpp17_proxy_iterator {
19 int operator*();
20 iterator_traits_cpp17_proxy_iterator& operator++();
22 // this returns legcay_iterator, not iterator_traits_cpp17_proxy_iterator
23 iterator_traits_cpp17_iterator operator++(int);
26 struct iterator_traits_cpp17_input_iterator {
27 using difference_type = int;
28 using value_type = long;
30 int& operator*();
31 iterator_traits_cpp17_input_iterator& operator++();
32 iterator_traits_cpp17_input_iterator operator++(int);
34 bool operator==(iterator_traits_cpp17_input_iterator const&) const;
37 struct iterator_traits_cpp17_proxy_input_iterator {
38 using difference_type = int;
39 using value_type = long;
41 int operator*();
42 iterator_traits_cpp17_proxy_input_iterator& operator++();
44 // this returns legcay_input_iterator, not iterator_traits_cpp17_proxy_input_iterator
45 iterator_traits_cpp17_input_iterator operator++(int);
47 bool operator==(iterator_traits_cpp17_proxy_input_iterator const&) const;
50 struct iterator_traits_cpp17_forward_iterator {
51 using difference_type = int;
52 using value_type = int;
54 int& operator*();
55 iterator_traits_cpp17_forward_iterator& operator++();
56 iterator_traits_cpp17_forward_iterator operator++(int);
58 bool operator==(iterator_traits_cpp17_forward_iterator const&) const;
61 struct iterator_traits_cpp17_bidirectional_iterator {
62 using difference_type = int;
63 using value_type = int;
65 int& operator*();
66 iterator_traits_cpp17_bidirectional_iterator& operator++();
67 iterator_traits_cpp17_bidirectional_iterator operator++(int);
68 iterator_traits_cpp17_bidirectional_iterator& operator--();
69 iterator_traits_cpp17_bidirectional_iterator operator--(int);
71 bool operator==(iterator_traits_cpp17_bidirectional_iterator const&) const;
74 struct iterator_traits_cpp17_random_access_iterator {
75 using difference_type = int;
76 using value_type = int;
78 int& operator*();
79 int& operator[](difference_type);
80 iterator_traits_cpp17_random_access_iterator& operator++();
81 iterator_traits_cpp17_random_access_iterator operator++(int);
82 iterator_traits_cpp17_random_access_iterator& operator--();
83 iterator_traits_cpp17_random_access_iterator operator--(int);
85 bool operator==(iterator_traits_cpp17_random_access_iterator const&) const;
86 bool operator<(iterator_traits_cpp17_random_access_iterator const&) const;
87 bool operator>(iterator_traits_cpp17_random_access_iterator const&) const;
88 bool operator<=(iterator_traits_cpp17_random_access_iterator const&) const;
89 bool operator>=(iterator_traits_cpp17_random_access_iterator const&) const;
91 iterator_traits_cpp17_random_access_iterator& operator+=(difference_type);
92 iterator_traits_cpp17_random_access_iterator& operator-=(difference_type);
94 friend iterator_traits_cpp17_random_access_iterator operator+(iterator_traits_cpp17_random_access_iterator,
95 difference_type);
96 friend iterator_traits_cpp17_random_access_iterator operator+(difference_type,
97 iterator_traits_cpp17_random_access_iterator);
98 friend iterator_traits_cpp17_random_access_iterator operator-(iterator_traits_cpp17_random_access_iterator,
99 difference_type);
100 friend difference_type operator-(iterator_traits_cpp17_random_access_iterator,
101 iterator_traits_cpp17_random_access_iterator);
104 #endif // TEST_SUPPORT_ITERATOR_TRAITS_ITERATOR_TRAITS_CPP17_ITERATORS