Closed marehr closed 3 years ago
From 9492f567ac2d853da2ae29621cd16de027415453 Mon Sep 17 00:00:00 2001 From: marehr <marehr-github@marehr.dialup.fu-berlin.de> Date: Sun, 18 Apr 2021 12:47:50 +0200 Subject: [PATCH 08/35] TODO: [MISC] deprecate seqan3::views::take.hpp --- include/seqan3/range/views/take.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/seqan3/range/views/take.hpp b/include/seqan3/range/views/take.hpp index 0c7519b86..02a2515b5 100644 --- a/include/seqan3/range/views/take.hpp +++ b/include/seqan3/range/views/take.hpp @@ -502,12 +502,15 @@ struct take_fn // string_view if constexpr (is_type_specialisation_of_v<std::remove_cvref_t<urng_t>, std::basic_string_view>) { + // in standard return urange.substr(0, target_size); } // string const & else if constexpr (is_type_specialisation_of_v<std::remove_cvref_t<urng_t>, std::basic_string> && std::is_const_v<std::remove_reference_t<urng_t>>) { + // not in standard + // seqan3::views::type_reduce does this too return std::basic_string_view{std::ranges::data(urange), target_size}; } // contiguous @@ -515,6 +518,8 @@ struct take_fn std::ranges::contiguous_range<urng_t> && std::ranges::sized_range<urng_t>) { + // not in standard (special case for std::span in standard) + // seqan3::views::type_reduce does this too return std::span{std::ranges::data(urange), target_size}; } // random_access @@ -522,6 +527,8 @@ struct take_fn std::ranges::random_access_range<urng_t> && std::ranges::sized_range<urng_t>) { + // not in standard + // seqan3::views::type_reduce does this too return std::ranges::subrange<std::ranges::iterator_t<urng_t>, std::ranges::iterator_t<urng_t>> { std::ranges::begin(urange), @@ -607,6 +614,8 @@ namespace seqan3::views * \include test/snippet/range/views/take.cpp * * \hideinitializer + * + * \deprecated Use std::views::take or seqan3::views::type_reduce | std::views::take. */ inline auto constexpr take = detail::take_fn<false, false>{}; -- 2.31.1
Tasks