• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
10 // <regex>
11 
12 // class match_results<BidirectionalIterator, Allocator>
13 
14 // match_results(const match_results& m);
15 
16 #include <regex>
17 #include <cassert>
18 #include "test_macros.h"
19 #include "test_allocator.h"
20 
21 template <class CharT, class Allocator>
22 void
test(const Allocator & a)23 test(const Allocator& a)
24 {
25     typedef std::match_results<const CharT*, Allocator> SM;
26     SM m0(a);
27     SM m1(m0);
28 
29     assert(m1.size()          == m0.size());
30     assert(m1.str()           == m0.str());
31     assert(m1.get_allocator() == m0.get_allocator());
32 }
33 
main()34 int main()
35 {
36     test<char>   (std::allocator<std::sub_match<const char *> >());
37     test<wchar_t>(std::allocator<std::sub_match<const wchar_t *> >());
38 
39     test<char>   (test_allocator<std::sub_match<const char*> >(3));
40     test<wchar_t>(test_allocator<std::sub_match<const wchar_t*> >(3));
41 }
42