SeqAn3  3.0.0
The Modern C++ library for sequence analysis.
iterator.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2019, 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::InputIterator 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::InputIterator 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::InputIterator 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::WeaklyIncrementable 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::WeaklyIncrementable 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 
163 template <typename it_t>
165 {
166 SEQAN3_DOXYGEN_ONLY(
168  using type = iterator_category;
169 )
170 };
171 
173 template <typename it_t>
174  requires requires { typename std::iterator_traits<it_t>::iterator_category; }
175 struct iterator_tag<it_t>
176 {
178 };
179 
180 template <std::InputIterator it_t>
181  requires !requires { typename std::iterator_traits<it_t>::iterator_category; }
182 struct iterator_tag<it_t>
183 {
185 };
186 
187 template <typename it_t>
189  !requires { typename std::iterator_traits<it_t>::iterator_category; }
190 struct iterator_tag<it_t>
191 {
193 };
194 
195 template <std::ForwardIterator it_t>
196  requires !requires { typename std::iterator_traits<it_t>::iterator_category; }
197 struct iterator_tag<it_t>
198 {
200 };
201 
202 template <std::BidirectionalIterator it_t>
203  requires !requires { typename std::iterator_traits<it_t>::iterator_category; }
204 struct iterator_tag<it_t>
205 {
207 };
208 
209 template <std::RandomAccessIterator it_t>
210  requires !requires { typename std::iterator_traits<it_t>::iterator_category; }
211 struct iterator_tag<it_t>
212 {
214 };
216 
221 template <typename it_t>
223  requires requires { typename iterator_tag<it_t>::type; }
226 
228 
229 } // namespace seqan3
Provides platform and dependency checks.
Provides various transformation trait base templates and shortcuts.
Exposes the iterator_category from the modelled concept.
Definition: iterator.hpp:164
Provides C++20 additions to the <iterator> header.
The InputIterator concept is a refinement of std::Iterator, adding the requirement that the reference...
The main SeqAn3 namespace.
decltype(std::ranges::iter_move(std::declval< it_t & >())) type
Return the member type as return type.
Definition: iterator.hpp:75
::ranges::iter_move iter_move
Alias for ranges::iter_move. Casts the result of dereferencing an object to its associated rvalue ref...
Definition: iterator:336
typename iterator_tag< it_t >::type iterator_tag_t
Return the iterator_category type of the input type (TransformationTrait shortcut).
Definition: iterator.hpp:225
Exposes the difference_type of another type.
Definition: pre.hpp:159
Exposes the size_type of another type.
Definition: pre.hpp:188
iterator_category type
The iterator_category.
Definition: iterator.hpp:169
typename std::iterator_traits< std::remove_reference_t< it_t > >::reference type
Return the member type as return type.
Definition: iterator.hpp:58
Exposes the rvalue_reference of another type.
Definition: pre.hpp:99
Exposes the reference of another type.
Definition: pre.hpp:70
The OutputIterator concept is a refinement of std::Iterator, adding the requirement that it can be us...
typename std::iterator_traits< std::remove_reference_t< it_t > >::difference_type type
Return the member type as return type.
Definition: iterator.hpp:98
Exposes the value_type of another type.
Definition: pre.hpp:41
typename std::iterator_traits< std::remove_reference_t< it_t > >::value_type type
Return the member type as return type.
Definition: iterator.hpp:41