assign_iter_iter_flag.pass.cpp revision 1d4a1edbc7e4461b59239e1b8297e9dd395a6322
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_iterators.h" 23 24int main() 25{ 26 typedef input_iterator<std::string::const_iterator> I; 27 typedef forward_iterator<std::string::const_iterator> F; 28 std::string s4("(a([bc]))"); 29 std::regex r2; 30 31 r2.assign(I(s4.begin()), I(s4.end())); 32 assert(r2.flags() == std::regex::ECMAScript); 33 assert(r2.mark_count() == 2); 34 35 r2.assign(I(s4.begin()), I(s4.end()), std::regex::extended); 36 assert(r2.flags() == std::regex::extended); 37 assert(r2.mark_count() == 2); 38 39 r2.assign(F(s4.begin()), F(s4.end())); 40 assert(r2.flags() == std::regex::ECMAScript); 41 assert(r2.mark_count() == 2); 42 43 r2.assign(F(s4.begin()), F(s4.end()), std::regex::extended); 44 assert(r2.flags() == std::regex::extended); 45 assert(r2.mark_count() == 2); 46} 47