[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / re / re.results / re.results.acc / cbegin_cend.pass.cpp
blobbd9009a8a447cd46a0222448d88d96c3a97c2504
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 // <regex>
11 // class match_results<BidirectionalIterator, Allocator>
13 // const_iterator cbegin() const;
14 // const_iterator cend() const;
16 #include <regex>
17 #include <cassert>
18 #include <cstddef>
19 #include "test_macros.h"
21 void
22 test()
24 std::match_results<const char*> m;
25 const char s[] = "abcdefghijk";
26 assert(std::regex_search(s, m, std::regex("cd((e)fg)hi")));
28 std::match_results<const char*>::const_iterator i = m.cbegin();
29 std::match_results<const char*>::const_iterator e = m.cend();
31 assert(static_cast<std::size_t>(e - i) == m.size());
32 for (int j = 0; i != e; ++i, ++j)
33 assert(*i == m[j]);
36 int main(int, char**)
38 test();
40 return 0;