• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <regex>
11 
12 // template <class charT, class traits = regex_traits<charT>> class basic_regex;
13 
14 // template <class InputIterator>
15 //    basic_regex&
16 //    assign(InputIterator first, InputIterator last,
17 //           flag_type f = regex_constants::ECMAScript);
18 
19 #include <regex>
20 #include <cassert>
21 
22 #include "test_macros.h"
23 #include "test_iterators.h"
24 
main()25 int main()
26 {
27     typedef input_iterator<std::string::const_iterator> I;
28     typedef forward_iterator<std::string::const_iterator> F;
29     std::string s4("(a([bc]))");
30     std::regex r2;
31 
32     r2.assign(I(s4.begin()), I(s4.end()));
33     assert(r2.flags() == std::regex::ECMAScript);
34     assert(r2.mark_count() == 2);
35 
36     r2.assign(I(s4.begin()), I(s4.end()), std::regex::extended);
37     assert(r2.flags() == std::regex::extended);
38     assert(r2.mark_count() == 2);
39 
40     r2.assign(F(s4.begin()), F(s4.end()));
41     assert(r2.flags() == std::regex::ECMAScript);
42     assert(r2.mark_count() == 2);
43 
44     r2.assign(F(s4.begin()), F(s4.end()), std::regex::extended);
45     assert(r2.flags() == std::regex::extended);
46     assert(r2.mark_count() == 2);
47 }
48