blob: d6399f1148b4a7366d4e60707d6206a740650803 [file] [log] [blame]
Howard Hinnant262b7792010-08-17 20:42:03 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant262b7792010-08-17 20:42:03 +00007//
8//===----------------------------------------------------------------------===//
9
10// <regex>
11
12// class regex_token_iterator<BidirectionalIterator, charT, traits>
13
14// bool operator==(const regex_token_iterator& right) const;
15// bool operator!=(const regex_token_iterator& right) const;
16
17#include <regex>
18#include <cassert>
19
20int main()
21{
22 {
23 std::regex phone_numbers("\\d{3}-\\d{4}");
24 const char phone_book[] = "start 555-1234, 555-2345, 555-3456 end";
Howard Hinnant59832522011-09-21 18:33:46 +000025 std::cregex_token_iterator i(std::begin(phone_book), std::end(phone_book)-1,
Howard Hinnant262b7792010-08-17 20:42:03 +000026 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 }
Howard Hinnanta8d77592010-08-18 00:13:08 +000036}