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++03 10 11 // <regex> 12 13 // class match_results<BidirectionalIterator, Allocator> 14 15 // match_results& operator=(match_results&& m); 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 SM m0(a); 28 SM m1; 29 30 m1 = std::move(m0); 31 assert(m1.size() == 0); 32 assert(m1.str() == std::basic_string<CharT>()); 33 if (std::allocator_traits<Allocator>::propagate_on_container_move_assignment::value) 34 assert(m1.get_allocator() == a); 35 else 36 assert(m1.get_allocator() == Allocator()); 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_allocator has POCMA -> false 45 test<char> (test_allocator<std::sub_match<const char*> >(3)); 46 test<wchar_t>(test_allocator<std::sub_match<const wchar_t*> >(3)); 47 48 // other_allocator has POCMA -> true 49 test<char> (other_allocator<std::sub_match<const char*> >(3)); 50 test<wchar_t>(other_allocator<std::sub_match<const wchar_t*> >(3)); 51 } 52