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 // UNSUPPORTED: c++03 9 // <regex> 10 11 // class match_results<BidirectionalIterator, Allocator> 12 13 // match_results(match_results&& m) noexcept; 14 // 15 // Additionally, the stored Allocator value is move constructed from m.get_allocator(). 16 17 #include <regex> 18 #include <cassert> 19 #include "test_macros.h" 20 #include "test_allocator.h" 21 22 template <class CharT, class Allocator> 23 void test(const Allocator & a)24test(const Allocator& a) 25 { 26 typedef std::match_results<const CharT*, Allocator> SM; 27 ASSERT_NOEXCEPT(SM(std::declval<SM&&>())); 28 29 SM m0(a); 30 assert(m0.get_allocator() == a); 31 32 SM m1(std::move(m0)); 33 assert(m1.size() == 0); 34 assert(!m1.ready()); 35 assert(m1.get_allocator() == a); 36 } 37 main(int,char **)38int main(int, char**) 39 { 40 test<char> (std::allocator<std::sub_match<const char *> >()); 41 test<wchar_t>(std::allocator<std::sub_match<const wchar_t *> >()); 42 43 test<char> (test_allocator<std::sub_match<const char*> >(3)); 44 assert(test_alloc_base::moved == 1); 45 test<wchar_t>(test_allocator<std::sub_match<const wchar_t*> >(3)); 46 assert(test_alloc_base::moved == 2); 47 48 return 0; 49 } 50