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