diff --git a/include/seqan3/io/views/detail/take_exactly_view.hpp b/include/seqan3/io/views/detail/take_exactly_view.hpp index c711ec667b..7f2d90cfb1 100644 --- a/include/seqan3/io/views/detail/take_exactly_view.hpp +++ b/include/seqan3/io/views/detail/take_exactly_view.hpp @@ -549,6 +549,7 @@ namespace seqan3::detail * | std::ranges::sized_range | | ***guaranteed*** | * | std::ranges::common_range | | *preserved* | * | std::ranges::output_range | | *preserved* except if `urng_t` is std::basic_string| + * | std::ranges::borrowed_range | | *preserved* | * | seqan3::const_iterable_range | | *preserved* | * | | | | * | std::ranges::range_reference_t | | std::ranges::range_reference_t | @@ -586,3 +587,12 @@ inline constexpr auto take_exactly = take_exactly_fn{}; */ inline constexpr auto take_exactly_or_throw = take_exactly_fn{}; } // namespace seqan3::detail + +namespace std::ranges +{ +//!\cond +template +inline constexpr bool enable_borrowed_range> = + enable_borrowed_range; +//!\endcond +} // namespace std::ranges diff --git a/include/seqan3/io/views/detail/take_until_view.hpp b/include/seqan3/io/views/detail/take_until_view.hpp index a2606b3e84..fe55838b43 100644 --- a/include/seqan3/io/views/detail/take_until_view.hpp +++ b/include/seqan3/io/views/detail/take_until_view.hpp @@ -531,6 +531,7 @@ namespace seqan3::detail * | std::ranges::sized_range | | *lost* | * | std::ranges::common_range | | *lost* | * | std::ranges::output_range | | *preserved* | + * | std::ranges::borrowed_range | | *preserved* | * | seqan3::const_iterable_range | | preservedยน | * | | | | * | std::ranges::range_reference_t | | std::ranges::range_reference_t | @@ -602,3 +603,12 @@ inline constexpr auto take_until_and_consume = take_until_fn{}; inline constexpr auto take_until_or_throw_and_consume = take_until_fn{}; } // namespace seqan3::detail + +namespace std::ranges +{ +//!\cond +template +inline constexpr bool enable_borrowed_range> = + enable_borrowed_range; +//!\endcond +} // namespace std::ranges diff --git a/include/seqan3/utility/views/single_pass_input.hpp b/include/seqan3/utility/views/single_pass_input.hpp index f40896b0f3..5a98df5bd7 100644 --- a/include/seqan3/utility/views/single_pass_input.hpp +++ b/include/seqan3/utility/views/single_pass_input.hpp @@ -327,6 +327,7 @@ namespace seqan3::views * | std::ranges::sized_range | | *lost* | * | std::ranges::common_range | | *lost* | * | std::ranges::output_range | | *lost* | + * | std::ranges::borrowed_range | | *preserved* | * | seqan3::const_iterable_range | | *lost* | * | | | | * | std::ranges::range_reference_t | | std::ranges::range_reference_t | @@ -346,3 +347,12 @@ inline constexpr auto single_pass_input = detail::adaptor_for_view_without_args< } // namespace seqan3::views //![adaptor_def] + +namespace std::ranges +{ +//!\cond +template +inline constexpr bool enable_borrowed_range> = + enable_borrowed_range; +//!\endcond +} // namespace std::ranges diff --git a/test/unit/io/views/detail/take_exactly_view_test.cpp b/test/unit/io/views/detail/take_exactly_view_test.cpp index a95816e611..29895ec4a2 100644 --- a/test/unit/io/views/detail/take_exactly_view_test.cpp +++ b/test/unit/io/views/detail/take_exactly_view_test.cpp @@ -69,6 +69,8 @@ void do_concepts(adaptor_t && adaptor, bool const exactly) EXPECT_TRUE(std::ranges::common_range); EXPECT_TRUE(seqan3::const_iterable_range); EXPECT_TRUE((std::ranges::output_range)); + EXPECT_TRUE(std::ranges::borrowed_range); + EXPECT_TRUE(std::ranges::borrowed_range); auto v3 = vec | std::views::transform( @@ -101,6 +103,8 @@ void do_concepts(adaptor_t && adaptor, bool const exactly) EXPECT_FALSE(std::ranges::common_range); EXPECT_FALSE(seqan3::const_iterable_range); EXPECT_FALSE((std::ranges::output_range)); + EXPECT_TRUE(std::ranges::borrowed_range); + EXPECT_TRUE(std::ranges::borrowed_range); // explicit test for non const-iterable views // https://github.com/seqan/seqan3/pull/1734#discussion_r408829267 diff --git a/test/unit/io/views/detail/take_until_view_test.cpp b/test/unit/io/views/detail/take_until_view_test.cpp index d57a949726..e4e7354d68 100644 --- a/test/unit/io/views/detail/take_until_view_test.cpp +++ b/test/unit/io/views/detail/take_until_view_test.cpp @@ -65,6 +65,8 @@ void do_concepts(adaptor_t && adaptor, bool const_it) EXPECT_FALSE(std::ranges::common_range); EXPECT_EQ(seqan3::const_iterable_range, const_it); EXPECT_TRUE((std::ranges::output_range)); + EXPECT_TRUE(std::ranges::borrowed_range); + EXPECT_TRUE(std::ranges::borrowed_range); auto v2 = vec | seqan3::views::single_pass_input | adaptor; @@ -77,6 +79,8 @@ void do_concepts(adaptor_t && adaptor, bool const_it) EXPECT_FALSE(std::ranges::common_range); EXPECT_FALSE(seqan3::const_iterable_range); EXPECT_FALSE((std::ranges::output_range)); // lost by single_pass_input + EXPECT_TRUE(std::ranges::borrowed_range); + EXPECT_TRUE(std::ranges::borrowed_range); // explicit test for non const-iterable views // https://github.com/seqan/seqan3/pull/1734#discussion_r408829267