Skip to content

Commit

Permalink
[MISC] deprecate seqan3::views::to_upper (#2538)
Browse files Browse the repository at this point in the history
* [MISC] deprecate seqan3::views::to_upper

* Update include/seqan3/range/views/to_upper.hpp

Co-authored-by: marehr <[email protected]>
Co-authored-by: Marcel <[email protected]>
  • Loading branch information
3 people authored Apr 23, 2021
1 parent 7de10d6 commit dca7146
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ regression test suite and patches at https://github.com/seqan/seqan3/tree/master
[Cookbook](https://docs.seqan.de/seqan/3.0.3/cookbook.html#cookbook_convert_alphabet_range).
* Deprecated `seqan3::views::drop`, use `std::views::drop` or `seqan3::views::type_reduce | std::views::drop`.
([\#2540](https://github.com/seqan/seqan3/pull/2540))
* 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))

#### Search

Expand Down
8 changes: 6 additions & 2 deletions include/seqan3/range/views/to_upper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/*!\file
* \author Tobias Loka <LokaT AT rki.de>
* \brief Provides seqan3::views::to_upper.
* \brief [DEPRECATED] Provides seqan3::views::to_upper.
*/

#pragma once
Expand Down Expand Up @@ -63,13 +63,17 @@ namespace seqan3::views
* ### Example
* \include test/snippet/range/views/to_upper.cpp
* \hideinitializer
*
* \deprecated Use std::views::transform([](auto && chr){return std::toupper(chr)});
*/
inline auto const to_upper = deep{std::views::transform([] (auto const in) noexcept
#ifdef SEQAN3_DEPRECATED_310
SEQAN3_DEPRECATED_310 inline auto const to_upper = deep{std::views::transform([] (auto const in) noexcept
{
static_assert(builtin_character<std::remove_cvref_t<decltype(in)>>,
"The value type of seqan3::views::to_upper must model the seqan3::builtin_character.");
return seqan3::to_upper(in);
})};
#endif // SEQAN3_DEPRECATED_310

//!\}

Expand Down
5 changes: 5 additions & 0 deletions test/snippet/range/views/to_upper.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifdef SEQAN3_DEPRECATED_310
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <string>
#include <vector>

Expand All @@ -14,3 +17,5 @@ int main()
seqan3::debug_stream << v1 << '\n'; // => "CHANGED!"
seqan3::debug_stream << v2 << '\n'; // => ["CHANGED", "UNCHANGED!"]
}
#pragma GCC diagnostic pop
#endif // SEQAN3_DEPRECATED_310
5 changes: 5 additions & 0 deletions test/unit/range/views/to_upper_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include <seqan3/range/views/to_upper.hpp>
#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;

Expand Down Expand Up @@ -95,3 +98,5 @@ TEST(view_to_upper, concepts)
EXPECT_FALSE((std::ranges::output_range<decltype(upper_view), char>));
EXPECT_FALSE(std::ranges::contiguous_range<decltype(upper_view)>);
}
#pragma GCC diagnostic pop
#endif // SEQAN3_DEPRECATED_310

1 comment on commit dca7146

@vercel
Copy link

@vercel vercel bot commented on dca7146 Apr 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.