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 // UNSUPPORTED: c++03, c++11
13 // iterator begin(); // constexpr since C++20
14 // iterator end(); // constexpr since C++20
15 // const_iterator begin() const; // constexpr since C++20
16 // const_iterator end() const; // constexpr since C++20
17 // const_iterator cbegin() const; // constexpr since C++20
18 // const_iterator cend() const; // constexpr since C++20
23 #include "test_macros.h"
26 TEST_CONSTEXPR_CXX20
void test() {
28 typename
C::iterator ii1
{}, ii2
{};
29 typename
C::iterator ii4
= ii1
;
30 typename
C::const_iterator cii
{};
35 assert(!(ii1
!= ii2
));
39 assert(!(ii1
!= cii
));
40 assert(!(cii
!= ii1
));
49 assert(cii
- ii1
== 0);
50 assert(ii1
- cii
== 0);
54 typename
C::iterator i1
= a
.begin();
55 typename
C::iterator i2
;
61 TEST_CONSTEXPR_CXX20
bool test() {
63 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
67 #ifndef TEST_HAS_NO_CHAR8_T
68 test
<std::u8string
>();
71 test
<std::u16string
>();
72 test
<std::u32string
>();
77 int main(int, char**) {
80 static_assert(test());