SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
concept.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 <seqan3/std/ranges>
16 
18 
19 namespace seqan3
20 {
21 
41 template <typename type>
43 SEQAN3_CONCEPT const_iterable_range =
44  std::ranges::input_range<std::remove_const_t<type>> &&
45  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 
81 template <typename iterator_t>
83 SEQAN3_CONCEPT pseudo_random_access_iterator =
84  std::forward_iterator<iterator_t> &&
87  std::totally_ordered<iterator_t> &&
88  std::sized_sentinel_for<iterator_t, iterator_t> &&
89  requires (iterator_t i, iterator_t const j, std::iter_difference_t<iterator_t> const n)
90 {
91  std::same_as<decltype( i += n ), iterator_t &>;
92  std::same_as<decltype( j + n ), iterator_t>;
93  std::same_as<decltype( n + j ), iterator_t>;
94  std::same_as<decltype( --i ), iterator_t &>;
95  std::same_as<decltype( i-- ), iterator_t>;
96  std::same_as<decltype( i -= n ), iterator_t &>;
97  std::same_as<decltype( j - n ), iterator_t>;
98  std::same_as<decltype( j[n] ), std::iter_reference_t<iterator_t>>;
99 };
101 
116 template <typename rng_t>
118 SEQAN3_CONCEPT pseudo_random_access_range =
119  std::ranges::forward_range<rng_t> &&
122 
137 template <typename rng_t>
139 SEQAN3_CONCEPT sequence = std::ranges::input_range<rng_t> && alphabet<std::ranges::range_reference_t<rng_t>>;
141 
142 } // namespace seqan3
pseudo_random_access_iterator
This concept checks if an iterator type models pseudo random access.
std::random_access_iterator_tag
std::iterator_traits
const_iterable_range
Specifies requirements of an input range type for which the const version of that type satisfies the ...
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
std::iter_difference_t
pseudo_random_access_range
This concept checks if a type models a pseudo random access range.
ranges
Adaptations of concepts from the Ranges TS.
alphabet
The generic alphabet concept that covers most data types used in ranges.
std::remove_const_t
sequence
The generic concept for a sequence.
concept.hpp
Core alphabet concept and free function/type trait wrappers.
std::is_base_of_v
T is_base_of_v