SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
iterator.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
15 #include <iterator>
16 #include <type_traits>
17 
18 #include <seqan3/core/platform.hpp>
20 #include <seqan3/std/iterator>
21 
22 namespace seqan3
23 {
24 
29 // ----------------------------------------------------------------------------
30 // value_type
31 // ----------------------------------------------------------------------------
32 
37 template <std::input_iterator it_t>
38 struct value_type<it_t>
39 {
42 };
43 
44 // see specialisation for ranges in core/type_traits/range.hpp
45 
46 // ----------------------------------------------------------------------------
47 // reference
48 // ----------------------------------------------------------------------------
49 
54 template <std::input_iterator it_t>
55 struct reference<it_t>
56 {
59 };
60 
61 // see specialisation for ranges in core/type_traits/range.hpp
62 
63 // ----------------------------------------------------------------------------
64 // rvalue_reference
65 // ----------------------------------------------------------------------------
66 
71 template <std::input_iterator it_t>
72 struct rvalue_reference<it_t>
73 {
75  using type = decltype(std::ranges::iter_move(std::declval<it_t &>()));
76 };
77 
78 // see specialisation for ranges in core/type_traits/range.hpp
79 
80 // ----------------------------------------------------------------------------
81 // const_reference
82 // ----------------------------------------------------------------------------
83 
84 // only defined for ranges
85 
86 // ----------------------------------------------------------------------------
87 // difference_type
88 // ----------------------------------------------------------------------------
89 
94 template <std::weakly_incrementable it_t>
95 struct difference_type<it_t>
96 {
99 };
100 
101 // see specialisation for ranges in core/type_traits/range.hpp
102 
103 // ----------------------------------------------------------------------------
104 // size_type
105 // ----------------------------------------------------------------------------
106 
111 template <std::weakly_incrementable it_t>
112 struct size_type<it_t>
113 {
116 };
117 
118 // see specialisation for ranges in core/type_traits/range.hpp
119 
120 // ----------------------------------------------------------------------------
121 // iterator_tag
122 // ----------------------------------------------------------------------------
123 
135 template <typename it_t>
137 {
138 SEQAN3_DOXYGEN_ONLY(
140  using type = iterator_category;
141 )
142 };
143 
145 template <typename it_t>
146  requires requires { typename std::iterator_traits<it_t>::iterator_category; }
147 struct iterator_tag<it_t>
148 {
150 };
151 
152 template <std::input_iterator it_t>
153  requires !requires { typename std::iterator_traits<it_t>::iterator_category; }
154 struct iterator_tag<it_t>
155 {
157 };
158 
159 template <typename it_t>
160  requires !std::input_iterator<it_t> && std::output_iterator<it_t, value_type_t<it_t>> &&
161  !requires { typename std::iterator_traits<it_t>::iterator_category; }
162 struct iterator_tag<it_t>
163 {
165 };
166 
167 template <std::forward_iterator it_t>
168  requires !requires { typename std::iterator_traits<it_t>::iterator_category; }
169 struct iterator_tag<it_t>
170 {
172 };
173 
174 template <std::bidirectional_iterator it_t>
175  requires !requires { typename std::iterator_traits<it_t>::iterator_category; }
176 struct iterator_tag<it_t>
177 {
179 };
180 
181 template <std::random_access_iterator it_t>
182  requires !requires { typename std::iterator_traits<it_t>::iterator_category; }
183 struct iterator_tag<it_t>
184 {
186 };
188 
193 template <typename it_t>
195  requires requires { typename iterator_tag<it_t>::type; }
198 
200 
201 } // namespace seqan3
pre.hpp
Provides various transformation trait base templates and shortcuts.
seqan3::iterator_tag
Exposes the iterator_category from the modelled concept.
Definition: iterator.hpp:136
seqan3::iterator_tag_t
typename iterator_tag< it_t >::type iterator_tag_t
Return the iterator_category type of the input type (transformation_trait shortcut).
Definition: iterator.hpp:197
iterator
Provides C++20 additions to the <iterator> header.
std::input_iterator_tag
seqan3::rvalue_reference< it_t >::type
decltype(std::ranges::iter_move(std::declval< it_t & >())) type
Return the member type as return type.
Definition: iterator.hpp:75
seqan3::value_type
Exposes the value_type of another type.
Definition: pre.hpp:41
std::iterator_traits
seqan3::difference_type
Exposes the difference_type of another type.
Definition: pre.hpp:159
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
seqan3::reference
Exposes the reference of another type.
Definition: pre.hpp:70
seqan3::size_type
Exposes the size_type of another type.
Definition: pre.hpp:188
seqan3::reference< it_t >::type
typename std::iterator_traits< std::remove_reference_t< it_t > >::reference type
Return the member type as return type.
Definition: iterator.hpp:58
platform.hpp
Provides platform and dependency checks.
seqan3::iterator_tag::type
iterator_category type
The iterator_category.
Definition: iterator.hpp:141
seqan3::value_type< it_t >::type
typename std::iterator_traits< std::remove_reference_t< it_t > >::value_type type
Return the member type as return type.
Definition: iterator.hpp:41
seqan3::difference_type< it_t >::type
typename std::iterator_traits< std::remove_reference_t< it_t > >::difference_type type
Return the member type as return type.
Definition: iterator.hpp:98
seqan3::rvalue_reference
Exposes the rvalue_reference of another type.
Definition: pre.hpp:99
std::make_unsigned_t