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