SeqAn3  3.2.0
The Modern C++ library for sequence analysis.
utility/range/concept.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 <ranges>
16 
17 #include <seqan3/core/platform.hpp>
18 
19 namespace seqan3
20 {
43 template <typename type>
44 concept const_iterable_range =
45  std::ranges::input_range<std::remove_const_t<type>> && std::ranges::input_range<type const>
46  && (std::ranges::forward_range<std::remove_const_t<type>> == std::ranges::forward_range<type const>)
47  && (std::ranges::bidirectional_range<std::remove_const_t<type>> == std::ranges::bidirectional_range<type const>)
48  && (std::ranges::random_access_range<std::remove_const_t<type>> == std::ranges::random_access_range<type const>);
50 
83 template <typename iterator_t>
84 concept pseudo_random_access_iterator = std::forward_iterator<iterator_t> && !
85 std::is_base_of_v<std::random_access_iterator_tag, typename std::iterator_traits<iterator_t>::iterator_category> &&
86  std::totally_ordered<iterator_t> &&
87  std::sized_sentinel_for<iterator_t, iterator_t> && requires (iterator_t i,
88  iterator_t const j,
89  std::iter_difference_t<iterator_t> const n) {
90  requires std::same_as<decltype(i += n), iterator_t &>;
91  requires std::same_as<decltype(j + n), iterator_t>;
92  requires std::same_as<decltype(n + j), iterator_t>;
93  requires std::same_as<decltype(--i), iterator_t &>;
94  requires std::same_as<decltype(i--), iterator_t>;
95  requires std::same_as<decltype(i -= n), iterator_t &>;
96  requires std::same_as<decltype(j - n), iterator_t>;
97  requires std::same_as<decltype(j[n]),
98  std::iter_reference_t<iterator_t>>;
99  };
101 
118 template <typename rng_t>
120  std::ranges::forward_range<rng_t> && pseudo_random_access_iterator<std::ranges::iterator_t<rng_t>>;
122 } // namespace seqan3
requires requires
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank....
Definition: alphabet/concept.hpp:164
Specifies requirements of an input range type for which the const version of that type satisfies the ...
This concept checks if an iterator type models pseudo random access.
This concept checks if a type models a pseudo random access range.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides platform and dependency checks.
The <ranges> header from C++20's standard library.