Howard Hinnant | a712c72 | 2010-08-16 20:21:16 +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 | a712c72 | 2010-08-16 20:21:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <regex> |
| 11 | |
| 12 | // template <class BidirectionalIterator, |
| 13 | // class charT = typename iterator_traits< BidirectionalIterator>::value_type, |
| 14 | // class traits = regex_traits<charT>> |
| 15 | // class regex_iterator |
| 16 | // { |
| 17 | // public: |
| 18 | // typedef basic_regex<charT, traits> regex_type; |
| 19 | // typedef match_results<BidirectionalIterator> value_type; |
| 20 | // typedef ptrdiff_t difference_type; |
| 21 | // typedef const value_type* pointer; |
| 22 | // typedef const value_type& reference; |
| 23 | // typedef forward_iterator_tag iterator_category; |
| 24 | |
| 25 | #include <regex> |
| 26 | #include <type_traits> |
| 27 | |
| 28 | template <class CharT> |
| 29 | void |
| 30 | test() |
| 31 | { |
| 32 | typedef std::regex_iterator<const CharT*> I; |
| 33 | static_assert((std::is_same<typename I::regex_type, std::basic_regex<CharT> >::value), ""); |
| 34 | static_assert((std::is_same<typename I::value_type, std::match_results<const CharT*> >::value), ""); |
| 35 | static_assert((std::is_same<typename I::difference_type, std::ptrdiff_t>::value), ""); |
| 36 | static_assert((std::is_same<typename I::pointer, const std::match_results<const CharT*>*>::value), ""); |
| 37 | static_assert((std::is_same<typename I::reference, const std::match_results<const CharT*>&>::value), ""); |
| 38 | static_assert((std::is_same<typename I::iterator_category, std::forward_iterator_tag>::value), ""); |
| 39 | } |
| 40 | |
| 41 | int main() |
| 42 | { |
| 43 | test<char>(); |
| 44 | test<wchar_t>(); |
Howard Hinnant | bbd8086 | 2010-08-22 00:45:01 +0000 | [diff] [blame] | 45 | } |