Loading...
Searching...
No Matches
iterator_traits.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <iterator>
#include <type_traits>
#include <seqan3/core/platform.hpp>
namespace seqan3::detail
{
template <typename underlying_iterator_t>
struct maybe_iterator_category
{
#if SEQAN3_DOXYGEN_ONLY(1) 0
using iterator_category = MAYBE_PRESENT(std::iterator_traits<underlying_iterator_t>::iterator_category);
#endif // SEQAN3_DOXYGEN_ONLY(1)0
};
template <typename t>
concept has_iterator_category = requires () { typename t::iterator_category; };
template <typename underlying_iterator_t>
requires has_iterator_category<std::iterator_traits<underlying_iterator_t>>
struct maybe_iterator_category<underlying_iterator_t>
{
using iterator_category = typename std::iterator_traits<underlying_iterator_t>::iterator_category;
};
template <typename underling_iterator_t>
struct maybe_inherited_iterator_category : public maybe_iterator_category<underling_iterator_t>
{};
template <typename underling_iterator_t>
requires has_iterator_category<underling_iterator_t>
struct maybe_inherited_iterator_category<underling_iterator_t>
{
// underling_iterator_t::iterator_category is already defined
};
template <typename it_t>
requires std::input_or_output_iterator<it_t>
using iterator_concept_tag_t = std::conditional_t<
std::contiguous_iterator<it_t>,
std::contiguous_iterator_tag,
std::conditional_t<std::random_access_iterator<it_t>,
std::random_access_iterator_tag,
std::conditional_t<std::bidirectional_iterator<it_t>,
std::bidirectional_iterator_tag,
std::conditional_t<std::forward_iterator<it_t>,
std::forward_iterator_tag,
std::conditional_t<std::input_iterator<it_t>,
std::input_iterator_tag,
std::output_iterator_tag>>>>>;
} // namespace seqan3::detail
namespace seqan3::detail
{
// ----------------------------------------------------------------------------
// iter_pointer
// ----------------------------------------------------------------------------
template <typename it_t>
struct iter_pointer
{
using type = void;
};
template <typename it_t>
requires requires { typename std::iterator_traits<it_t>::pointer; }
struct iter_pointer<it_t>
{
using type = typename std::iterator_traits<it_t>::pointer;
};
template <typename it_t>
using iter_pointer_t = typename iter_pointer<it_t>::type;
} // namespace seqan3::detail
iterator
platform.hpp
Provides platform and dependency checks.
type_traits
Hide me