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 //===----------------------------------------------------------------------===//
8
9 // <regex>
10
11 // class regex_iterator<BidirectionalIterator, charT, traits>
12
13 // template <size_t N>
14 // regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
15 // const regex_type&& re,
16 // const int (&submatches)[N],
17 // regex_constants::match_flag_type m =
18 // regex_constants::match_default);
19
20 #include <regex>
21 #include <vector>
22 #include <cassert>
23 #include "test_macros.h"
24
25 #if TEST_STD_VER < 14
26 #error
27 #endif
28
main(int,char **)29 int main(int, char**)
30 {
31 {
32 std::regex phone_numbers("\\d{3}-(\\d{4})");
33 const char phone_book[] = "start 555-1234, 555-2345, 555-3456 end";
34 const int indices[] = {-1, 0, 1};
35 std::cregex_token_iterator i(std::begin(phone_book), std::end(phone_book)-1,
36 std::regex("\\d{3}-\\d{4}"), indices);
37 }
38
39 return 0;
40 }
41