1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
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_token_iterator
16 // {
17 // public:
18 // typedef basic_regex<charT, traits> regex_type;
19 // typedef sub_match<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
test()30 test()
31 {
32 typedef std::regex_token_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::sub_match<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::sub_match<const CharT*>*>::value), "");
37 static_assert((std::is_same<typename I::reference, const std::sub_match<const CharT*>&>::value), "");
38 static_assert((std::is_same<typename I::iterator_category, std::forward_iterator_tag>::value), "");
39 }
40
main()41 int main()
42 {
43 test<char>();
44 test<wchar_t>();
45 }
46