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_token_iterator<BidirectionalIterator, charT, traits>
12
13 // bool operator==(const regex_token_iterator& right) const;
14 // bool operator!=(const regex_token_iterator& right) const;
15
16 #include <regex>
17 #include <cassert>
18 #include "test_macros.h"
19
main(int,char **)20 int main(int, char**)
21 {
22 {
23 std::regex phone_numbers("\\d{3}-\\d{4}");
24 const char phone_book[] = "start 555-1234, 555-2345, 555-3456 end";
25 std::cregex_token_iterator i(std::begin(phone_book), std::end(phone_book)-1,
26 phone_numbers, -1);
27 assert(i != std::cregex_token_iterator());
28 assert(!(i == std::cregex_token_iterator()));
29 std::cregex_token_iterator i2 = i;
30 assert(i2 == i);
31 assert(!(i2 != i));
32 ++i;
33 assert(!(i2 == i));
34 assert(i2 != i);
35 }
36
37 return 0;
38 }
39