diff --git a/include/seqan3/alignment/aligned_sequence/aligned_sequence_concept.hpp b/include/seqan3/alignment/aligned_sequence/aligned_sequence_concept.hpp index 22e1d91fdb..bad5d0e9e0 100644 --- a/include/seqan3/alignment/aligned_sequence/aligned_sequence_concept.hpp +++ b/include/seqan3/alignment/aligned_sequence/aligned_sequence_concept.hpp @@ -14,6 +14,7 @@ #pragma once #include +#include #include #include @@ -22,11 +23,11 @@ #include #include #include +#include #include #include #include #include -#include // --------------------------------------------------------------------------------------------------------------------- // unaligned_seq transformation trait @@ -202,8 +203,8 @@ namespace seqan3 //!\cond template SEQAN3_CONCEPT aligned_sequence = + sequence && std::ranges::forward_range && - alphabet> && weakly_assignable_from, gap const &> && requires { typename detail::unaligned_seq_t; } && requires (t v, detail::unaligned_seq_t unaligned) diff --git a/include/seqan3/alphabet/all.hpp b/include/seqan3/alphabet/all.hpp index 2e0ff35d27..fd348bed59 100644 --- a/include/seqan3/alphabet/all.hpp +++ b/include/seqan3/alphabet/all.hpp @@ -166,6 +166,7 @@ * * We provide specialised containers with certain properties in the \ref range module. * + * A container over an seqan3::alphabet automatically models the seqan3::sequence concept. */ #pragma once diff --git a/include/seqan3/core/detail/debug_stream_range.hpp b/include/seqan3/core/detail/debug_stream_range.hpp index 3dbff854ab..44040cb031 100644 --- a/include/seqan3/core/detail/debug_stream_range.hpp +++ b/include/seqan3/core/detail/debug_stream_range.hpp @@ -12,12 +12,14 @@ #pragma once +#include + #include #include #include #include #include -#include +#include namespace seqan3::detail { @@ -96,34 +98,38 @@ inline debug_stream_type & operator<<(debug_stream_type & s, rng static_assert(detail::reference_type_is_streamable_v, "The reference type of the passed range cannot be streamed into the debug_stream."); - if constexpr (alphabet> && - !detail::is_uint_adaptation_v>>) + s << '['; + auto b = std::ranges::begin(r); + auto e = std::ranges::end(r); + if (b != e) { - for (auto && l : r) - s << l; + s << *b; + ++b; } - else + while (b != e) { - s << '['; - auto b = std::ranges::begin(r); - auto e = std::ranges::end(r); - if (b != e) - { - s << *b; - ++b; - } - while (b != e) - { - s << ','; - s << *b; - ++b; - } - s << ']'; + s << ','; + s << *b; + ++b; } + s << ']'; return s; } +//!\overload +template +inline debug_stream_type & operator<<(debug_stream_type & s, rng_t && r) +//!\cond + requires detail::debug_stream_range_guard && + !detail::is_uint_adaptation_v>> +//!\endcond +{ + for (auto && l : r) + s << l; + + return s; +} //!\} } // namespace seqan3 diff --git a/include/seqan3/range/concept.hpp b/include/seqan3/range/concept.hpp index a3c08e0eac..ee291a727f 100644 --- a/include/seqan3/range/concept.hpp +++ b/include/seqan3/range/concept.hpp @@ -14,7 +14,7 @@ #include -#include +#include namespace seqan3 { @@ -135,4 +135,23 @@ SEQAN3_CONCEPT pseudo_random_access_range = pseudo_random_access_iterator>; //!\endcond +/*!\interface seqan3::sequence <> + * \brief The generic concept for a sequence. + * \ingroup range + * \extends std::ranges::input_range + * + * We define a range over an seqan3::alphabet as a *sequence*. + * A type models seqan3::sequence if it is at least an std::ranges::input_range + * and its references type models seqan3::alphabet. + * + * ### Concepts and doxygen + * + * The requirements for this concept are given as related functions and type traits. + * Types that model this concept are shown as "implementing this interface". + */ +//!\cond +template +SEQAN3_CONCEPT sequence = std::ranges::input_range && alphabet>; +//!\endcond + } // namespace seqan3