SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
iterator_traits.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <iterator>
13#include <type_traits>
14
16
17namespace seqan3::detail
18{
37template <typename underlying_iterator_t>
39{
40#if SEQAN3_DOXYGEN_ONLY(1) 0
48#endif // SEQAN3_DOXYGEN_ONLY(1)0
49};
50
52template <typename t>
53concept has_iterator_category = requires () { typename t::iterator_category; };
55
57template <typename underlying_iterator_t>
58 requires has_iterator_category<std::iterator_traits<underlying_iterator_t>>
59struct maybe_iterator_category<underlying_iterator_t>
60{
62};
64
75template <typename underling_iterator_t>
77{};
78
80template <typename underling_iterator_t>
81 requires has_iterator_category<underling_iterator_t>
82struct maybe_inherited_iterator_category<underling_iterator_t>
83{
84 // underling_iterator_t::iterator_category is already defined
85};
87
94template <typename it_t>
95 requires std::input_or_output_iterator<it_t>
97 std::contiguous_iterator<it_t>,
98 std::contiguous_iterator_tag,
108
109} // namespace seqan3::detail
110
111namespace seqan3::detail
112{
113// ----------------------------------------------------------------------------
114// iter_pointer
115// ----------------------------------------------------------------------------
116
127template <typename it_t>
129{
131 using type = void;
132};
133
135template <typename it_t>
136 requires requires { typename std::iterator_traits<it_t>::pointer; }
137struct iter_pointer<it_t>
138{
142};
144
150template <typename it_t>
152
153} // 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:151
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides platform and dependency checks.
This is like std::iter_value_t, but for the pointer type.
Definition iterator_traits.hpp:129
void type
The pointer type of std::iterator_traits or void.
Definition iterator_traits.hpp:131
This handles more cases than maybe_iterator_category if you inherit the underling_iterator_t.
Definition iterator_traits.hpp:77
Defines iterator_category member if underlying_iterator_t has a valid std::iterator_traits::iterator_...
Definition iterator_traits.hpp:39
MAYBE_PRESENT(std::iterator_traits< underlying_iterator_t >::iterator_category) iterator_category
The iterator category tag. (not always present!)
Definition iterator_traits.hpp:47
Hide me