Debian Codegraph @

libcxx/test/std/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp

raw
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 // template <class charT, class traits = regex_traits<charT>> class basic_regex;
12
13 // template <class string_traits, class A>
14 // basic_regex& assign(const basic_string<charT, string_traits, A>& s,
15 // flag_type f = regex_constants::ECMAScript);
16
17 #include <cassert>
18 #include <regex>
19 #include <string>
20
21 #include "test_macros.h"
22
23 int main(int, char**)
24 {
25 std::regex r2;
26 r2.assign(std::string("(a([bc]))"));
27 assert(r2.flags() == std::regex::ECMAScript);
28 assert(r2.mark_count() == 2);
29
30 r2.assign(std::string("(a([bc]))"), std::regex::extended);
31 assert(r2.flags() == std::regex::extended);
32 assert(r2.mark_count() == 2);
33
34 return 0;
35 }