1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template<class Category, class T, class Distance = ptrdiff_t,
12 // class Pointer = T*, class Reference = T&>
15 // typedef T value_type;
16 // typedef Distance difference_type;
17 // typedef Pointer pointer;
18 // typedef Reference reference;
19 // typedef Category iterator_category;
23 #include <type_traits>
25 #include "test_macros.h"
33 typedef std::iterator
<std::forward_iterator_tag
, T
> It
;
34 static_assert((std::is_same
<typename
It::value_type
, T
>::value
), "");
35 static_assert((std::is_same
<typename
It::difference_type
, std::ptrdiff_t>::value
), "");
36 static_assert((std::is_same
<typename
It::pointer
, T
*>::value
), "");
37 static_assert((std::is_same
<typename
It::reference
, T
&>::value
), "");
38 static_assert((std::is_same
<typename
It::iterator_category
, std::forward_iterator_tag
>::value
), "");
45 typedef std::iterator
<std::bidirectional_iterator_tag
, T
, short> It
;
46 static_assert((std::is_same
<typename
It::value_type
, T
>::value
), "");
47 static_assert((std::is_same
<typename
It::difference_type
, short>::value
), "");
48 static_assert((std::is_same
<typename
It::pointer
, T
*>::value
), "");
49 static_assert((std::is_same
<typename
It::reference
, T
&>::value
), "");
50 static_assert((std::is_same
<typename
It::iterator_category
, std::bidirectional_iterator_tag
>::value
), "");
57 typedef std::iterator
<std::random_access_iterator_tag
, T
, int, const T
*> It
;
58 static_assert((std::is_same
<typename
It::value_type
, T
>::value
), "");
59 static_assert((std::is_same
<typename
It::difference_type
, int>::value
), "");
60 static_assert((std::is_same
<typename
It::pointer
, const T
*>::value
), "");
61 static_assert((std::is_same
<typename
It::reference
, T
&>::value
), "");
62 static_assert((std::is_same
<typename
It::iterator_category
, std::random_access_iterator_tag
>::value
), "");
69 typedef std::iterator
<std::input_iterator_tag
, T
, long, const T
*, const T
&> It
;
70 static_assert((std::is_same
<typename
It::value_type
, T
>::value
), "");
71 static_assert((std::is_same
<typename
It::difference_type
, long>::value
), "");
72 static_assert((std::is_same
<typename
It::pointer
, const T
*>::value
), "");
73 static_assert((std::is_same
<typename
It::reference
, const T
&>::value
), "");
74 static_assert((std::is_same
<typename
It::iterator_category
, std::input_iterator_tag
>::value
), "");