Debian Codegraph @

libcxx/test/std/re/re.regex/re.regex.nonmemb/re.regex.nmswap/swap.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 charT, class traits>
14 // void swap(basic_regex<charT, traits>& lhs, basic_regex<charT, traits>& rhs);
15
16 #include <regex>
17 #include <cassert>
18 #include "test_macros.h"
19
20 int main(int, char**)
21 {
22 std::regex r1("(a([bc]))");
23 std::regex r2;
24 swap(r2, r1);
25 assert(r1.flags() == std::regex::ECMAScript);
26 assert(r1.mark_count() == 0);
27 assert(r2.flags() == std::regex::ECMAScript);
28 assert(r2.mark_count() == 2);
29
30 return 0;
31 }