Howard Hinnant | 7e9d84b | 2010-06-30 00:21:42 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | 7e9d84b | 2010-06-30 00:21:42 +0000 | [diff] [blame] | 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 | |
| 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), ""); |
Marshall Clow | 103af34 | 2014-02-26 01:56:31 +0000 | [diff] [blame] | 38 | static_assert((std::is_same<typename MR::reference, std::sub_match<CharT*>& >::value), ""); |
Howard Hinnant | 7e9d84b | 2010-06-30 00:21:42 +0000 | [diff] [blame] | 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() |
| 48 | { |
| 49 | test<char>(); |
| 50 | test<wchar_t>(); |
| 51 | } |