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 //===----------------------------------------------------------------------===//
13 // const_iterator begin() const;
14 // const_iterator end() const;
15 // const_iterator cbegin() const;
16 // const_iterator cend() const;
22 #include "test_macros.h"
23 #include "min_allocator.h"
29 typedef std::vector
<T
> C
;
31 C::iterator i
= c
.begin();
32 C::iterator j
= c
.end();
33 assert(std::distance(i
, j
) == 0);
38 typedef std::vector
<T
> C
;
40 C::const_iterator i
= c
.begin();
41 C::const_iterator j
= c
.end();
42 assert(std::distance(i
, j
) == 0);
47 typedef std::vector
<T
> C
;
49 C::const_iterator i
= c
.cbegin();
50 C::const_iterator j
= c
.cend();
51 assert(std::distance(i
, j
) == 0);
57 typedef std::vector
<T
> C
;
61 #if TEST_STD_VER >= 11
64 typedef std::vector
<T
, min_allocator
<T
>> C
;
66 C::iterator i
= c
.begin();
67 C::iterator j
= c
.end();
68 assert(std::distance(i
, j
) == 0);
73 typedef std::vector
<T
, min_allocator
<T
>> C
;
75 C::const_iterator i
= c
.begin();
76 C::const_iterator j
= c
.end();
77 assert(std::distance(i
, j
) == 0);
82 typedef std::vector
<T
, min_allocator
<T
>> C
;
84 C::const_iterator i
= c
.cbegin();
85 C::const_iterator j
= c
.cend();
86 assert(std::distance(i
, j
) == 0);
92 typedef std::vector
<T
, min_allocator
<T
>> C
;
99 std::vector
<bool>::iterator ii1
{}, ii2
{};
100 std::vector
<bool>::iterator ii4
= ii1
;
101 std::vector
<bool>::const_iterator cii
{};
102 assert ( ii1
== ii2
);
103 assert ( ii1
== ii4
);
105 assert (!(ii1
!= ii2
));
107 assert ( (ii1
== cii
));
108 assert ( (cii
== ii1
));
109 assert (!(ii1
!= cii
));
110 assert (!(cii
!= ii1
));
111 assert (!(ii1
< cii
));
112 assert (!(cii
< ii1
));
113 assert ( (ii1
<= cii
));
114 assert ( (cii
<= ii1
));
115 assert (!(ii1
> cii
));
116 assert (!(cii
> ii1
));
117 assert ( (ii1
>= cii
));
118 assert ( (cii
>= ii1
));
119 assert (cii
- ii1
== 0);
120 assert (ii1
- cii
== 0);