Skip to content

Commit

Permalink
[MISC] deprecate seqan3::views::move
Browse files Browse the repository at this point in the history
  • Loading branch information
marehr committed Apr 26, 2021
1 parent 5cd019b commit 4bc7c3e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ regression test suite and patches at https://github.com/seqan/seqan3/tree/master
([\#2524](https://github.com/seqan/seqan3/pull/2524)).
* Deprecated `seqan3::views::drop`, use `std::views::drop` or `seqan3::views::type_reduce | std::views::drop`.
([\#2540](https://github.com/seqan/seqan3/pull/2540))
* Deprecated `seqan3::views::move`, use the `std::ranges::move` algorithm, `std::[cpp20::]move_iterator` or an explicit
for loop where you move the value.
([\#2563](https://github.com/seqan/seqan3/pull/2563))
* We deprecated `seqan3::views::to_upper` and it will be removed in 3.1.0, use
`std::views::transform([](auto && chr){return std::toupper(chr)})`.
([\#2540](https://github.com/seqan/seqan3/pull/2538))
Expand Down
6 changes: 5 additions & 1 deletion include/seqan3/range/views/move.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ namespace seqan3::views
*
* A more useful example can be found in \link sequence_file_section_fun_with_ranges the tutorial \endlink.
* \hideinitializer
* \deprecated Use the std::ranges::move algorithm, std::[cpp20::]move_iterator or an explicit for loop where you move
* the value.
*/
inline auto const move = std::views::transform(detail::multi_invocable
#ifdef SEQAN3_DEPRECATED_310
SEQAN3_DEPRECATED_310 inline auto const move = std::views::transform(detail::multi_invocable
{
[] (auto && arg) -> std::remove_cvref_t<decltype(arg)> { return std::move(arg); },
[] (auto & arg) -> decltype(auto) { return std::move(arg); }
});
#endif // SEQAN3_DEPRECATED_310
//!\}

} // namespace seqan3::views
7 changes: 7 additions & 0 deletions test/snippet/range/views/move.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#include <seqan3/core/platform.hpp>

#ifdef SEQAN3_DEPRECATED_310
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <string>

#include <seqan3/range/views/move.hpp>
Expand All @@ -18,3 +23,5 @@ int main()
std::ranges::copy(vec_in | seqan3::views::move, // moves strings from in to out
vec_out1.begin());
}
#pragma GCC diagnostic pop
#endif // SEQAN3_DEPRECATED_310
2 changes: 2 additions & 0 deletions test/snippet/utility/views/drop.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <seqan3/core/platform.hpp>

#ifdef SEQAN3_DEPRECATED_310
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Expand Down
2 changes: 2 additions & 0 deletions test/unit/range/views/drop_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include <seqan3/range/concept.hpp>
#include <seqan3/range/container/concept.hpp>
#ifdef SEQAN3_DEPRECATED_310
#include <seqan3/range/views/drop.hpp>
#endif // SEQAN3_DEPRECATED_310
#include <seqan3/range/views/single_pass_input.hpp>
#include <seqan3/test/expect_range_eq.hpp>
#include <seqan3/test/expect_same_type.hpp>
Expand Down
9 changes: 9 additions & 0 deletions test/unit/range/views/move_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@
#include <seqan3/alphabet/views/complement.hpp>
#include <seqan3/core/detail/debug_stream_alphabet.hpp>
#include <seqan3/range/concept.hpp>
#ifdef SEQAN3_DEPRECATED_310
#include <seqan3/range/views/move.hpp>
#endif // SEQAN3_DEPRECATED_310
#include <seqan3/test/expect_range_eq.hpp>

#ifdef SEQAN3_DEPRECATED_310
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

using seqan3::operator""_dna5;

TEST(view_move, basic)
Expand Down Expand Up @@ -69,3 +75,6 @@ TEST(view_move, concepts)

EXPECT_TRUE((std::is_same_v<decltype(v2[0]), seqan3::dna5>)); // don't add const-ness to values
}

#pragma GCC diagnostic pop
#endif // SEQAN3_DEPRECATED_310

0 comments on commit 4bc7c3e

Please sign in to comment.