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 // template <class BidirectionalIterator,
13 // class Allocator = allocator<sub_match<BidirectionalIterator>>>
14 // class match_results
15 // {
16 // public:
17 // typedef sub_match<BidirectionalIterator> value_type;
18 // typedef const value_type& const_reference;
19 // typedef const_reference reference;
20 // typedef /implementation-defined/ const_iterator;
21 // typedef const_iterator iterator;
22 // typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
23 // typedef typename allocator_traits<Allocator>::size_type size_type;
24 // typedef Allocator allocator_type;
25 // typedef typename iterator_traits<BidirectionalIterator>::value_type char_type;
26 // typedef basic_string<char_type> string_type;
27
28 #include <regex>
29 #include <type_traits>
30 #include "test_macros.h"
31
32 template <class CharT>
33 void
test()34 test()
35 {
36 typedef std::match_results<CharT*> MR;
37 static_assert((std::is_same<typename MR::value_type, std::sub_match<CharT*> >::value), "");
38 static_assert((std::is_same<typename MR::const_reference, const std::sub_match<CharT*>& >::value), "");
39 static_assert((std::is_same<typename MR::reference, std::sub_match<CharT*>& >::value), "");
40 static_assert((!std::is_same<typename MR::const_iterator, void>::value), "");
41 static_assert((std::is_same<typename MR::difference_type, std::ptrdiff_t>::value), "");
42 static_assert((std::is_same<typename MR::size_type, std::size_t>::value), "");
43 static_assert((std::is_same<typename MR::allocator_type, std::allocator<std::sub_match<CharT*> > >::value), "");
44 static_assert((std::is_same<typename MR::char_type, CharT>::value), "");
45 static_assert((std::is_same<typename MR::string_type, std::basic_string<CharT> >::value), "");
46 }
47
main()48 int main()
49 {
50 test<char>();
51 test<wchar_t>();
52 }
53