[OpenMP][Docs] Update OpenMP supported features table (#126292)
[llvm-project.git] / libcxx / test / std / re / re.results / re.results.const / copy_assign.pass.cpp
blob33dbeb9e556f762ba451e43a00671bc99365a5dd
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 //===----------------------------------------------------------------------===//
9 // <regex>
11 // class match_results<BidirectionalIterator, Allocator>
13 // match_results& operator=(const match_results& m);
15 #include <regex>
16 #include <cassert>
17 #include "test_macros.h"
18 #include "test_allocator.h"
20 template <class CharT, class Allocator>
21 void
22 test(const Allocator& a)
24 typedef std::match_results<const CharT*, Allocator> SM;
25 SM m0(a);
26 SM m1;
28 m1 = m0;
29 assert(m1.size() == m0.size());
30 assert(m1.ready() == m0.ready());
31 if (std::allocator_traits<Allocator>::propagate_on_container_copy_assignment::value)
32 assert(m1.get_allocator() == m0.get_allocator());
33 else
34 assert(m1.get_allocator() == Allocator());
37 int main(int, char**)
39 test<char> (std::allocator<std::sub_match<const char *> >());
40 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
41 test<wchar_t>(std::allocator<std::sub_match<const wchar_t *> >());
42 #endif
44 // test_allocator has POCCA -> false
45 test<char> (test_allocator<std::sub_match<const char*> >(3));
46 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
47 test<wchar_t>(test_allocator<std::sub_match<const wchar_t*> >(3));
48 #endif
50 // other_allocator has POCCA -> true
51 test<char> (other_allocator<std::sub_match<const char*> >(3));
52 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
53 test<wchar_t>(other_allocator<std::sub_match<const wchar_t*> >(3));
54 #endif
56 return 0;