SeqAn3  3.0.1
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 
17 #include <seqan3/core/platform.hpp>
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 
57 template <typename type>
59 SEQAN3_CONCEPT forwarding_range = std::ranges::range<type> && requires (type && val)
60 {
61  std::ranges::begin(std::forward<type>(val));
62  std::ranges::end(std::forward<type>(val));
63 };
65 
96 template <typename iterator_t>
98 SEQAN3_CONCEPT pseudo_random_access_iterator =
99  std::forward_iterator<iterator_t> &&
103  std::sized_sentinel_for<iterator_t, iterator_t> &&
104  requires (iterator_t i, iterator_t const j, std::iter_difference_t<iterator_t> const n)
105 {
106  std::same_as<decltype( i += n ), iterator_t &>;
107  std::same_as<decltype( j + n ), iterator_t>;
108  std::same_as<decltype( n + j ), iterator_t>;
109  std::same_as<decltype( --i ), iterator_t &>;
110  std::same_as<decltype( i-- ), iterator_t>;
111  std::same_as<decltype( i -= n ), iterator_t &>;
112  std::same_as<decltype( j - n ), iterator_t>;
114 };
116 
131 template <typename rng_t>
133 SEQAN3_CONCEPT pseudo_random_access_range =
134  std::ranges::forward_range<rng_t> &&
137 
138 } // namespace seqan3
pseudo_random_access_iterator
This concept checks if an iterator type models pseudo random access.
std::random_access_iterator_tag
totally_ordered
Requires std::equality_comparable and all remaing comparison operators (<, <=, >, >=).
same_as
The concept std::same_as<T, U> is satisfied if and only if T and U denote the same type.
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:36
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.
platform.hpp
Provides platform and dependency checks.
std::ranges::begin
T begin(T... args)
std::remove_const_t
forwarding_range
Specifies a range whose iterators may outlive the range and remain valid.
std::is_base_of_v
T is_base_of_v