| 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 charT = typename iterator_traits< BidirectionalIterator>::value_type, |
| 13 | // class traits = regex_traits<charT>> |
| 14 | // class regex_iterator |
| 15 | // { |
| 16 | // public: |
| 17 | // typedef basic_regex<charT, traits> regex_type; |
| 18 | // typedef match_results<BidirectionalIterator> value_type; |
| 19 | // typedef ptrdiff_t difference_type; |
| 20 | // typedef const value_type* pointer; |
| 21 | // typedef const value_type& reference; |
| 22 | // typedef forward_iterator_tag iterator_category; |
| 23 | // typedef input_iterator_tag iterator_concept; // since C++20 |
| 24 | |
| 25 | #include <regex> |
| 26 | #include <type_traits> |
| 27 | #include "test_macros.h" |
| 28 | |
| 29 | template <class CharT> |
| 30 | void |
| 31 | test() |
| 32 | { |
| 33 | typedef std::regex_iterator<const CharT*> I; |
| 34 | static_assert((std::is_same<typename I::regex_type, std::basic_regex<CharT> >::value), "" ); |
| 35 | static_assert((std::is_same<typename I::value_type, std::match_results<const CharT*> >::value), "" ); |
| 36 | static_assert((std::is_same<typename I::difference_type, std::ptrdiff_t>::value), "" ); |
| 37 | static_assert((std::is_same<typename I::pointer, const std::match_results<const CharT*>*>::value), "" ); |
| 38 | static_assert((std::is_same<typename I::reference, const std::match_results<const CharT*>&>::value), "" ); |
| 39 | static_assert((std::is_same<typename I::iterator_category, std::forward_iterator_tag>::value), "" ); |
| 40 | #if TEST_STD_VER >= 20 |
| 41 | static_assert(std::is_same_v<typename I::iterator_concept, std::input_iterator_tag>); |
| 42 | #endif |
| 43 | } |
| 44 | |
| 45 | int main(int, char**) |
| 46 | { |
| 47 | test<char>(); |
| 48 | #ifndef TEST_HAS_NO_WIDE_CHARACTERS |
| 49 | test<wchar_t>(); |
| 50 | #endif |
| 51 | |
| 52 | return 0; |
| 53 | } |
| 54 | |