xref: /minix3/external/bsd/libc++/dist/libcxx/test/re/re.results/re.results.nonmember/equal.pass.cpp (revision 4684ddb6aab0b36791c8099bc705d6140b3d05d0)
1*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===//
2*4684ddb6SLionel Sambuc //
3*4684ddb6SLionel Sambuc //                     The LLVM Compiler Infrastructure
4*4684ddb6SLionel Sambuc //
5*4684ddb6SLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
6*4684ddb6SLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
7*4684ddb6SLionel Sambuc //
8*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===//
9*4684ddb6SLionel Sambuc 
10*4684ddb6SLionel Sambuc // <regex>
11*4684ddb6SLionel Sambuc 
12*4684ddb6SLionel Sambuc // class match_results<BidirectionalIterator, Allocator>
13*4684ddb6SLionel Sambuc 
14*4684ddb6SLionel Sambuc // template <class BidirectionalIterator, class Allocator>
15*4684ddb6SLionel Sambuc //    bool
16*4684ddb6SLionel Sambuc //    operator==(const match_results<BidirectionalIterator, Allocator>& m1,
17*4684ddb6SLionel Sambuc //               const match_results<BidirectionalIterator, Allocator>& m2);
18*4684ddb6SLionel Sambuc 
19*4684ddb6SLionel Sambuc // template <class BidirectionalIterator, class Allocator>
20*4684ddb6SLionel Sambuc //    bool
21*4684ddb6SLionel Sambuc //    operator!=(const match_results<BidirectionalIterator, Allocator>& m1,
22*4684ddb6SLionel Sambuc //               const match_results<BidirectionalIterator, Allocator>& m2);
23*4684ddb6SLionel Sambuc 
24*4684ddb6SLionel Sambuc #include <regex>
25*4684ddb6SLionel Sambuc #include <cassert>
26*4684ddb6SLionel Sambuc 
27*4684ddb6SLionel Sambuc void
test()28*4684ddb6SLionel Sambuc test()
29*4684ddb6SLionel Sambuc {
30*4684ddb6SLionel Sambuc     std::match_results<const char*> m1;
31*4684ddb6SLionel Sambuc     const char s[] = "abcdefghijk";
32*4684ddb6SLionel Sambuc     assert(std::regex_search(s, m1, std::regex("cd((e)fg)hi")));
33*4684ddb6SLionel Sambuc     std::match_results<const char*> m2;
34*4684ddb6SLionel Sambuc 
35*4684ddb6SLionel Sambuc     assert(m1 == m1);
36*4684ddb6SLionel Sambuc     assert(m1 != m2);
37*4684ddb6SLionel Sambuc 
38*4684ddb6SLionel Sambuc     m2 = m1;
39*4684ddb6SLionel Sambuc 
40*4684ddb6SLionel Sambuc     assert(m1 == m2);
41*4684ddb6SLionel Sambuc }
42*4684ddb6SLionel Sambuc 
main()43*4684ddb6SLionel Sambuc int main()
44*4684ddb6SLionel Sambuc {
45*4684ddb6SLionel Sambuc     test();
46*4684ddb6SLionel Sambuc }
47