blob: 4d553837efe8b7f3e9c0ba87a2dd36d70fb13dd9 [file] [log] [blame]
Howard Hinnant7e9d84b2010-06-30 00:21:42 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant7e9d84b2010-06-30 00:21:42 +00007//
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
31template <class CharT>
32void
33test()
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), "");
Marshall Clow103af342014-02-26 01:56:31 +000038 static_assert((std::is_same<typename MR::reference, std::sub_match<CharT*>& >::value), "");
Howard Hinnant7e9d84b2010-06-30 00:21:42 +000039 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
47int main()
48{
49 test<char>();
50 test<wchar_t>();
51}