SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
iterator_traits.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, 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
19
20namespace seqan3::detail
21{
40template <typename underlying_iterator_t>
42{
43#if SEQAN3_DOXYGEN_ONLY(1) 0
51#endif // SEQAN3_DOXYGEN_ONLY(1)0
52};
53
55template <typename t>
56concept has_iterator_category = requires () { typename t::iterator_category; };
58
59#if SEQAN3_WORKAROUND_GCC_96070
63template <typename underlying_iterator_t>
64 requires (!has_iterator_category<std::iterator_traits<underlying_iterator_t>>)
65struct maybe_iterator_category<underlying_iterator_t>
66{
67 using iterator_category = void;
68};
69#endif // SEQAN3_WORKAROUND_GCC_96070
70
72template <typename underlying_iterator_t>
73 requires has_iterator_category<std::iterator_traits<underlying_iterator_t>>
74struct maybe_iterator_category<underlying_iterator_t>
75{
77};
79
90template <typename underling_iterator_t>
92{};
93
95template <typename underling_iterator_t>
96 requires has_iterator_category<underling_iterator_t>
97struct maybe_inherited_iterator_category<underling_iterator_t>
98{
99 // underling_iterator_t::iterator_category is already defined
100};
102
109template <typename it_t>
110 requires std::input_or_output_iterator<it_t>
112 std::contiguous_iterator<it_t>,
113 std::contiguous_iterator_tag,
123
124} // namespace seqan3::detail
125
126namespace seqan3::detail
127{
128// ----------------------------------------------------------------------------
129// iter_pointer
130// ----------------------------------------------------------------------------
131
142template <typename it_t>
144{
146 using type = void;
147};
148
150template <typename it_t>
151 requires requires { typename std::iterator_traits<it_t>::pointer; }
152struct iter_pointer<it_t>
153{
157};
159
165template <typename it_t>
167
168} // namespace seqan3::detail
typename iter_pointer< it_t >::type iter_pointer_t
Return the pointer type of the input type (transformation_trait shortcut).
Definition: iterator_traits.hpp:166
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides platform and dependency checks.
This is like std::iter_value_t, but for the pointer type.
Definition: iterator_traits.hpp:144
void type
The pointer type of std::iterator_traits or void.
Definition: iterator_traits.hpp:146
This handles more cases than maybe_iterator_category if you inherit the underling_iterator_t.
Definition: iterator_traits.hpp:92
Defines iterator_category member if underlying_iterator_t has a valid std::iterator_traits::iterator_...
Definition: iterator_traits.hpp:42
MAYBE_PRESENT(std::iterator_traits< underlying_iterator_t >::iterator_category) iterator_category
The iterator category tag. (not always present!)
Definition: iterator_traits.hpp:50