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_token_iterator
15// {
16// public:
17// typedef basic_regex<charT, traits> regex_type;
18// typedef sub_match<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
29template <class CharT>
30void
31test()
32{
33 typedef std::regex_token_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::sub_match<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::sub_match<const CharT*>*>::value), "");
38 static_assert((std::is_same<typename I::reference, const std::sub_match<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
45int main(int, char**)
46{
47 test<char>();
48 test<wchar_t>();
49
50 return 0;
51}
52

source code of libcxx/test/std/re/re.iter/re.tokiter/types.pass.cpp