diff --git a/doc/cookbook/index.md b/doc/cookbook/index.md index a4db81d0c1..cdcae95496 100644 --- a/doc/cookbook/index.md +++ b/doc/cookbook/index.md @@ -410,7 +410,6 @@ Search for keywords with `Strg + F`. \include test/snippet/core/debug_stream_set_underlying_stream.cpp \include test/snippet/core/debug_stream_set_underlying_stream2.cpp \include test/snippet/core/debug_stream_usage.cpp -\include test/snippet/core/detail/copyable_wrapper.cpp \include test/snippet/core/detail/customisation_point.cpp \include test/snippet/core/detail/deferred_crtp_base.cpp \include test/snippet/core/detail/is_class_template_declarable_with.cpp diff --git a/include/seqan3/alignment/configuration/align_config_on_result.hpp b/include/seqan3/alignment/configuration/align_config_on_result.hpp index 0df654303b..3741b75d91 100644 --- a/include/seqan3/alignment/configuration/align_config_on_result.hpp +++ b/include/seqan3/alignment/configuration/align_config_on_result.hpp @@ -12,8 +12,8 @@ #include #include +#include #include -#include namespace seqan3::align_cfg { @@ -22,7 +22,7 @@ namespace seqan3::align_cfg * \ingroup alignment_configuration * * \tparam callback_t The type of the callback; must model std::invocable with the generated seqan3::alignment_result - * and std::copy_constructible. + * and std::move_constructible. * * \details * @@ -35,7 +35,7 @@ namespace seqan3::align_cfg * function, you need to make sure that the referenced function object outlives the call to the alignment algorithm. * * \if DEV - * The given callback is wrapped inside a seqan3::detail::copyable_wrapper wrapper type. This allows to also + * The given callback is wrapped inside a seqan::stl::detail::movable_box wrapper type. This allows to also * use lambdas with a capture block, which otherwise are not std::copy_assignable and therefore invalidate the * requirements for the configuration element (must model std::semiregular). * \endif @@ -46,12 +46,12 @@ namespace seqan3::align_cfg * * \include test/snippet/alignment/configuration/align_cfg_on_result.cpp */ -template +template class on_result : private seqan3::pipeable_config_element { public: //!\brief The stored callable which will be invoked with the alignment result. - seqan3::detail::copyable_wrapper_t callback; // Allows lambdas with capture blocks. + seqan::stl::detail::movable_box_t callback; // Allows lambdas with capture blocks. /*!\name Constructors, destructor and assignment * \{ @@ -79,7 +79,7 @@ class on_result : private seqan3::pipeable_config_element * \{ */ //!\brief Deduces the callback type from a forwarding constructor argument. -template +template on_result(callback_t &&) -> on_result>; //!\} } // namespace seqan3::align_cfg diff --git a/include/seqan3/alignment/pairwise/align_pairwise.hpp b/include/seqan3/alignment/pairwise/align_pairwise.hpp index f2f7e97bf1..10fac255aa 100644 --- a/include/seqan3/alignment/pairwise/align_pairwise.hpp +++ b/include/seqan3/alignment/pairwise/align_pairwise.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -163,8 +162,8 @@ constexpr auto align_pairwise(sequence_t && sequences, alignment_config_t const static_assert(std::ranges::random_access_range && std::ranges::sized_range, "Alignment configuration error: The sequence must model random_access_range and sized_range."); - // Pipe with seqan3::detail::all to allow rvalue non-view ranges. - auto seq_view = std::forward(sequences) | seqan3::detail::all; + // Pipe with std::views::all to allow rvalue non-view ranges. + auto seq_view = std::forward(sequences) | std::views::all; // Configure the alignment algorithm. auto && [algorithm, complete_config] = detail::alignment_configurator::configure(config); diff --git a/include/seqan3/alignment/pairwise/detail/concept.hpp b/include/seqan3/alignment/pairwise/detail/concept.hpp index 29c0d5b647..bd4ec6ad84 100644 --- a/include/seqan3/alignment/pairwise/detail/concept.hpp +++ b/include/seqan3/alignment/pairwise/detail/concept.hpp @@ -121,7 +121,7 @@ concept align_pairwise_single_input = * a) An lvalue range, whose reference type is a tuple like lvalue reference, * b) A range, whose reference type is a tuple over viewable ranges. * This covers also transforming and non-transforming views (e.g. views::zip, or views::take). - * Only a temporary non-view range piped with seqan3::detail::all can't be handled securely. + * Only a temporary non-view range piped with std::views::all can't be handled securely. */ //!\cond template diff --git a/include/seqan3/core/configuration/detail/concept.hpp b/include/seqan3/core/configuration/detail/concept.hpp index 2ec0bcdc2a..b70f553415 100644 --- a/include/seqan3/core/configuration/detail/concept.hpp +++ b/include/seqan3/core/configuration/detail/concept.hpp @@ -47,7 +47,7 @@ inline constexpr std::array, 0> compatibility_table{}; * \brief Concept for an algorithm configuration element. * \ingroup core_configuration * - * \extends std::copyable + * \extends std::movable * \implements seqan3::pipeable_config_element */ @@ -64,7 +64,7 @@ inline constexpr std::array, 0> compatibility_table{}; template concept config_element = requires { requires std::is_base_of_v; - requires std::copyable; + requires std::movable; { config_t::id }; }; //!\endcond diff --git a/include/seqan3/core/detail/all_view.hpp b/include/seqan3/core/detail/all_view.hpp deleted file mode 100644 index 10533c43f7..0000000000 --- a/include/seqan3/core/detail/all_view.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin -// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik -// SPDX-License-Identifier: BSD-3-Clause - -/*!\file - * \author Enrico Seiler - * \brief Provides seqan3::detail::all. - */ - -#pragma once - -#include -#include - -namespace seqan3::detail -{ - -/*!\brief A move-only view that takes unique ownership of a range. - * \ingroup core - * \sa https://en.cppreference.com/w/cpp/ranges/owning_view - */ -using SEQAN3_DOXYGEN_ONLY(owning_view =) seqan::stl::ranges::owning_view; - -/*!\brief Returns a view that includes all elements of the range argument. - * \ingroup core - * \sa https://en.cppreference.com/w/cpp/ranges/all_view - * \details - * This implements the new C++20 behaviour that is only available with gcc12 and newer. - * In contrast to the old std::views::all, rvalue ranges can be bound. - * \returns - * * `rng` if `rng` is a view. - * * A std::ranges::ref_view of `rng` if that expression is valid. - * * Otherwise, a seqan3::detail::owning_view of `rng`. - */ -using SEQAN3_DOXYGEN_ONLY(all =) seqan::stl::views::all; - -/*!\brief Returns the type that results from appying seqan3::detail::all to a range. - * \ingroup core - */ -using SEQAN3_DOXYGEN_ONLY(all_t =) seqan::stl::views::all_t; - -} // namespace seqan3::detail diff --git a/include/seqan3/core/detail/copyable_wrapper.hpp b/include/seqan3/core/detail/copyable_wrapper.hpp deleted file mode 100644 index d05346f232..0000000000 --- a/include/seqan3/core/detail/copyable_wrapper.hpp +++ /dev/null @@ -1,256 +0,0 @@ -// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin -// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik -// SPDX-License-Identifier: BSD-3-Clause - -/*!\file - * \brief Provides seqan3::detail::copyable_wrapper. - * \author Enrico Seiler - */ - -#pragma once - -#include -#include - -#include - -namespace seqan3::detail -{ - -/*!\brief Helper concept for seqan3::detail::copyable_wrapper. - * \ingroup core - * \see https://en.cppreference.com/w/cpp/ranges/copyable_wrapper - * \noapi{Exposition only.} - */ -template -concept boxable = std::copy_constructible && std::is_object_v; - -/*!\brief Utility wrapper that behaves like std::optional but makes the type conform with the std::copyable concept. - * \ingroup core - * \see https://en.cppreference.com/w/cpp/ranges/copyable_wrapper - */ -template -class copyable_wrapper : public std::optional -{ -public: - using std::optional::optional; //!< Use std::optional constructors. - using std::optional::operator=; //!< Use std::optional assignment operators. - constexpr copyable_wrapper(copyable_wrapper const &) = default; //!< Defaulted. - constexpr copyable_wrapper(copyable_wrapper &&) = default; //!< Defaulted. - constexpr ~copyable_wrapper() = default; //!< Defaulted. - - /*!\brief Use a specialised default constructor, if the wrapped type is default initialisable. - * If not, the default constructor of std::optional is used. - */ - constexpr copyable_wrapper() noexcept(std::is_nothrow_default_constructible_v) - requires std::default_initializable - : copyable_wrapper{std::in_place} - {} - - //!\brief Copy assignment for non-copyable wrapped types. - constexpr copyable_wrapper & operator=(copyable_wrapper const & other) - noexcept(std::is_nothrow_copy_constructible_v) - requires (!std::copyable) - { - if (this != std::addressof(other)) - { - if (other) - this->emplace(*other); - else - this->reset(); - } - return *this; - } - - //!\brief Move assignment for non-movable wrapped types. - constexpr copyable_wrapper & operator=(copyable_wrapper && other) noexcept(std::is_nothrow_move_constructible_v) - requires (!std::movable) - { - if (this != std::addressof(other)) - { - if (other) - this->emplace(std::move(*other)); - else - this->reset(); - } - return *this; - } - - /*!\brief Invokes the wrapped object with passed arguments. - * \throws std::bad_optional_access if no value is contained. - * \details - * - * This is a SeqAn-specific extension that allows easy invocation of the wrapped object. - * `t` needs to be callable with the passed arguments. - * - * Constness of this function depends on the constness of the call-operator of the wrapped object. - * - * \include test/snippet/core/detail/copyable_wrapper.cpp - */ - template - requires std::invocable - constexpr decltype(auto) operator()(args_t... args) noexcept(std::is_nothrow_invocable_v) - { - return std::invoke(this->value(), std::forward(args)...); - } - - //!\overload - template - requires std::invocable - constexpr decltype(auto) operator()(args_t... args) const noexcept(std::is_nothrow_invocable_v) - { - return std::invoke(this->value(), std::forward(args)...); - } -}; - -/*!\brief Utility wrapper that behaves like std::optional but makes the type conform with the std::copyable concept. - * \ingroup core - * \see https://en.cppreference.com/w/cpp/ranges/copyable_wrapper - * \details - * - * If `t` is `std::copyable`, the STL allows to store `t` directly, i.e. no `std::optional` is needed. - */ -template - requires std::copyable - || (std::is_nothrow_move_constructible_v && std::is_nothrow_copy_constructible_v) -#if SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW // If views must be default constructible, t must also be - && std::default_initializable -#endif - class copyable_wrapper -{ -private: - t value{}; //!< An object of the wrapped type. - -public: - //!\brief copyable_wrapper is default constructible, iff the wrapped type is default initialisable. - constexpr copyable_wrapper() - requires std::default_initializable - = default; - - constexpr copyable_wrapper(copyable_wrapper const &) = default; //!< Defaulted. - constexpr copyable_wrapper(copyable_wrapper &&) = default; //!< Defaulted. - constexpr ~copyable_wrapper() = default; //!< Defaulted. - - //!\brief Copy assignment for copyable types is the default copy assignment. - constexpr copyable_wrapper & operator=(copyable_wrapper const &) - requires std::copyable - = default; - - //!\brief Copy assignment for non-copyable types uses the Destroy-then-copy paradigm. - constexpr copyable_wrapper & operator=(copyable_wrapper const & other) noexcept - { - // Destroy-then-copy - if (this != std::addressof(other)) - { - value.~t(); // Call destructor of value - std::construct_at(std::addressof(value), *other); // Copy construct - } - return *this; - } - - //!\brief Move assignment for copyable types is the default move assignment. - constexpr copyable_wrapper & operator=(copyable_wrapper &&) - requires std::copyable - = default; - - //!\brief Move assignment for non-copyable types uses the Destroy-then-copy paradigm. - constexpr copyable_wrapper & operator=(copyable_wrapper && other) noexcept - { - // Destroy-then-copy - if (this != std::addressof(other)) - { - value.~t(); // Call destructor of value - std::construct_at(std::addressof(value), std::move(*other)); // Move construct - } - return *this; - } - - //!\brief Copy construct from value. - constexpr explicit copyable_wrapper(t const & other) noexcept(std::is_nothrow_copy_constructible_v) : - value{other} - {} - - //!\brief Move construct from value. - constexpr explicit copyable_wrapper(t && other) noexcept(std::is_nothrow_move_constructible_v) : - value{std::move(other)} - {} - - //!\brief Construct from argument pack. Part of the std::optional API. - template - requires std::constructible_from - constexpr explicit copyable_wrapper(std::in_place_t, args_t... args) - noexcept(std::is_nothrow_constructible_v) : - value{std::forward(args)...} - {} - - //!\brief Return whether the wrapper contains a value. Part of the std::optional API. - constexpr bool has_value() const noexcept - { - return true; // t is copyable, hence we always store a value. - } - - //!\brief Returns a reference to the wrapped object. Part of the std::optional API. - constexpr t & operator*() noexcept - { - return value; - } - - //!\brief Returns a reference to the wrapped object. Part of the std::optional API. - constexpr t const & operator*() const noexcept - { - return value; - } - - //!\brief Returns a pointer to the wrapped object. Part of the std::optional API. - constexpr t * operator->() noexcept - { - return std::addressof(value); - } - - //!\brief Returns a pointer to the wrapped object. Part of the std::optional API. - constexpr t const * operator->() const noexcept - { - return std::addressof(value); - } - - /*!\brief Invokes the wrapped object with passed arguments. - * \details - * - * This is a SeqAn-specific extension that allows easy invocation of the wrapped object. - * `t` needs to be callable with the passed arguments. - * - * Constness of this function depends on the constness of the call-operator of the wrapped object. - * - * \include test/snippet/core/detail/copyable_wrapper.cpp - */ - template - requires std::invocable - constexpr decltype(auto) operator()(args_t... args) noexcept(std::is_nothrow_invocable_v) - { - return std::invoke(value, std::forward(args)...); - } - - //!\overload - template - requires std::invocable - constexpr decltype(auto) operator()(args_t... args) const noexcept(std::is_nothrow_invocable_v) - { - return std::invoke(value, std::forward(args)...); - } -}; - -/*!\brief Type deduction guide that strips references. - * \relates seqan3::detail::copyable_wrapper - */ -template -copyable_wrapper(t) -> copyable_wrapper>; - -/*!\brief Utility transformation trait to get a wrapper type that models std::copyable. - * \ingroup core - * - * \see https://en.cppreference.com/w/cpp/ranges/copyable_wrapper - */ -template -using copyable_wrapper_t = copyable_wrapper>; - -} // namespace seqan3::detail diff --git a/include/seqan3/core/platform.hpp b/include/seqan3/core/platform.hpp index 912700ff85..0940e61de7 100644 --- a/include/seqan3/core/platform.hpp +++ b/include/seqan3/core/platform.hpp @@ -185,27 +185,8 @@ static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supp # define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1 #endif -//!\brief A view does not need to be default constructible. This change is first implemented in gcc12. -#ifndef SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW -# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12) -# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 1 -# else -# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 0 -# endif -#endif - -//!\brief See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100139 -//! std::views::{take, drop} do not type-erase. This is a defect within the standard lib (fixed in gcc12). -#ifndef SEQAN3_WORKAROUND_GCC_100139 -# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12) -# define SEQAN3_WORKAROUND_GCC_100139 1 -# else -# define SEQAN3_WORKAROUND_GCC_100139 0 -# endif -#endif - #ifndef SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY -# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ >= 12) +# if SEQAN3_COMPILER_IS_GCC // For checking whether workaround applies, e.g., in search_scheme_test # define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 1 // The goal is to create _Pragma("GCC diagnostic ignored \"-Wrestrict\"") diff --git a/include/seqan3/io/views/detail/take_until_view.hpp b/include/seqan3/io/views/detail/take_until_view.hpp index e73a18f930..a2606b3e84 100644 --- a/include/seqan3/io/views/detail/take_until_view.hpp +++ b/include/seqan3/io/views/detail/take_until_view.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include @@ -58,7 +58,7 @@ class view_take_until : public std::ranges::view_interface fun; + seqan::stl::detail::movable_box_t fun; //!\brief Whether this view is const_iterable or not. static constexpr bool const_iterable = @@ -201,7 +201,7 @@ class view_take_until::basic_consume_itera using base_t = inherited_iterator_base; //!\brief Pointer to the functor stored in the view. - copyable_wrapper_t const * fun{nullptr}; + seqan::stl::detail::movable_box_t const * fun{nullptr}; //!\brief The sentinel type is identical to that of the underlying range. using underlying_sentinel_t = seqan3::detail::maybe_const_sentinel_t; @@ -225,8 +225,9 @@ class view_take_until::basic_consume_itera ~basic_consume_iterator() = default; //!< Defaulted. //!\brief Constructor that delegates to the CRTP layer and initialises the callable. - basic_consume_iterator(underlying_iterator_t it, copyable_wrapper_t const & _fun, underlying_sentinel_t sen) - noexcept(noexcept(base_t{it})) : + basic_consume_iterator(underlying_iterator_t it, + seqan::stl::detail::movable_box_t const & _fun, + underlying_sentinel_t sen) noexcept(noexcept(base_t{it})) : base_t{std::move(it)}, fun{std::addressof(_fun)}, underlying_sentinel{std::move(sen)} @@ -348,7 +349,7 @@ class view_take_until::basic_sentinel underlying_sentinel_t underlying_sentinel{}; //!\brief Pointer to the functor stored in the view. - copyable_wrapper_t const * fun{nullptr}; + seqan::stl::detail::movable_box_t const * fun{nullptr}; public: /*!\name Constructors, destructor and assignment @@ -365,7 +366,8 @@ class view_take_until::basic_sentinel * \param[in] underlying_sentinel The actual end of the underlying range. * \param[in] _fun Reference to the functor stored in the view. */ - explicit basic_sentinel(underlying_sentinel_t underlying_sentinel, copyable_wrapper_t const & _fun) : + explicit basic_sentinel(underlying_sentinel_t underlying_sentinel, + seqan::stl::detail::movable_box_t const & _fun) : underlying_sentinel{std::move(underlying_sentinel)}, fun{std::addressof(_fun)} {} diff --git a/include/seqan3/search/configuration/on_result.hpp b/include/seqan3/search/configuration/on_result.hpp index bd42e3f4ef..fdd44186f1 100644 --- a/include/seqan3/search/configuration/on_result.hpp +++ b/include/seqan3/search/configuration/on_result.hpp @@ -11,8 +11,8 @@ #include +#include #include -#include #include namespace seqan3::search_cfg @@ -23,7 +23,7 @@ namespace seqan3::search_cfg * \see search_configuration * * \tparam callback_t The type of the callback; must model std::invocable with the generated seqan3::search_result - * and std::copy_constructible. + * and std::move_constructible. * * \details * @@ -36,7 +36,7 @@ namespace seqan3::search_cfg * user callback can be more efficient in a concurrent environment. * * \if DEV - * The given callback is wrapped inside a seqan3::detail::copyable_wrapper wrapper type. This allows to also + * The given callback is wrapped inside a seqan::stl::detail::movable_box wrapper type. This allows to also * use lambdas with a capture block, which otherwise are not std::copy_assignable and therefore invalidate the * requirements for the configuration element (must model std::semiregular). * \endif @@ -47,12 +47,12 @@ namespace seqan3::search_cfg * * \include test/snippet/search/configuration_on_result.cpp */ -template +template class on_result : private seqan3::pipeable_config_element { public: //!\brief The stored callable which will be invoked with the search result. - seqan3::detail::copyable_wrapper_t callback; // Allows lambdas with capture blocks. + seqan::stl::detail::movable_box_t callback; // Allows lambdas with capture blocks. /*!\name Constructors, destructor and assignment * \{ @@ -80,7 +80,7 @@ class on_result : private seqan3::pipeable_config_element * \{ */ //!\brief Deduces the callback type from a forwarding constructor argument. -template +template on_result(callback_t &&) -> on_result>; //!\} } // namespace seqan3::search_cfg diff --git a/include/seqan3/search/search.hpp b/include/seqan3/search/search.hpp index 97677ff603..f179217a2e 100644 --- a/include/seqan3/search/search.hpp +++ b/include/seqan3/search/search.hpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -215,7 +214,7 @@ inline auto search(std::initializer_list const & queries, { query.push_back(std::string_view{q}); }); - return search(std::move(query) | seqan3::detail::all, index, cfg); + return search(std::move(query) | std::views::all, index, cfg); } //!\endcond diff --git a/include/seqan3/utility/container/aligned_allocator.hpp b/include/seqan3/utility/container/aligned_allocator.hpp index 0661bc5ba7..8a5ffce4d6 100644 --- a/include/seqan3/utility/container/aligned_allocator.hpp +++ b/include/seqan3/utility/container/aligned_allocator.hpp @@ -15,11 +15,6 @@ #include -// __cpp_aligned_new is a C++17 feature that we use in this allocator and we require it. -#if __cpp_aligned_new < 201606 -# pragma GCC warning "Non-C++17 compliant compiler! Please open an issue with your compiler and platform!" -#endif // __cpp_aligned_new < 201606 - namespace seqan3 { @@ -178,24 +173,10 @@ class aligned_allocator { size_t bytes_to_deallocate = n * sizeof(value_type); - // Clang doesn't have __cpp_sized_deallocation defined by default even though this is a C++14! feature - // > In Clang 3.7 and later, sized deallocation is only enabled if the user passes the `-fsized-deallocation` - // > flag. - // see also https://clang.llvm.org/cxx_status.html#n3778 -#if __cpp_sized_deallocation >= 201309 - // gcc if constexpr (alignment <= __STDCPP_DEFAULT_NEW_ALIGNMENT__) ::operator delete(p, bytes_to_deallocate); else // Use alignment aware deallocator function. ::operator delete(p, bytes_to_deallocate, static_cast(alignment)); -#else /*__cpp_sized_deallocation >= 201309*/ - // e.g. clang++ - (void)bytes_to_deallocate; - if constexpr (alignment <= __STDCPP_DEFAULT_NEW_ALIGNMENT__) - ::operator delete(p); - else // Use alignment aware deallocator function. - ::operator delete(p, static_cast(alignment)); -#endif // __cpp_sized_deallocation >= 201309 } /*!\brief The aligned_allocator member template class aligned_allocator::rebind provides a way to obtain an diff --git a/include/seqan3/utility/simd/views/iota_simd.hpp b/include/seqan3/utility/simd/views/iota_simd.hpp index c2d0cbd48c..053e857fdf 100644 --- a/include/seqan3/utility/simd/views/iota_simd.hpp +++ b/include/seqan3/utility/simd/views/iota_simd.hpp @@ -272,7 +272,6 @@ inline constexpr detail::iota_simd_view_fn iota_simd{}; } // namespace seqan3::views -#ifdef __cpp_lib_ranges namespace std::ranges { //!\cond @@ -280,4 +279,3 @@ template inline constexpr bool enable_borrowed_range> = true; //!\endcond } // namespace std::ranges -#endif // __cpp_lib_ranges diff --git a/include/seqan3/utility/views/interleave.hpp b/include/seqan3/utility/views/interleave.hpp index b9d3063133..29e230c62d 100644 --- a/include/seqan3/utility/views/interleave.hpp +++ b/include/seqan3/utility/views/interleave.hpp @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -116,11 +115,11 @@ class view_interleave : public std::ranges::view_interface requires std::constructible_from()))> - && std::constructible_from> + && std::constructible_from> explicit constexpr view_interleave(orng_t && _urange, size_t const _step_size, oirng_t && _inserted_range) : view_interleave{views::type_reduce(std::forward(_urange)), _step_size, - seqan3::detail::all(std::forward(_inserted_range))} + std::views::all(std::forward(_inserted_range))} {} //!\} @@ -246,7 +245,7 @@ template , std::ranges::range_reference_t> view_interleave(urng_t &&, size_t, inserted_rng_t &&) - -> view_interleave())), seqan3::detail::all_t>; + -> view_interleave())), std::views::all_t>; // ============================================================================ // interleave_fn (adaptor definition) diff --git a/include/seqan3/utility/views/slice.hpp b/include/seqan3/utility/views/slice.hpp index 3c415f7fa0..ed1aff88ed 100644 --- a/include/seqan3/utility/views/slice.hpp +++ b/include/seqan3/utility/views/slice.hpp @@ -57,47 +57,9 @@ struct slice_fn if (end_pos < begin_pos) throw std::invalid_argument{"end_pos argument to seqan3::views::slice must be >= the begin_pos argument."}; - // SEQAN3_WORKAROUND_GCC_100139 == 1 if std::views::{take, drop} does not type reduce (e.g. keep in type - // std::basic_string_view, std::span, std::ranges::subrange). - // See https://github.com/seqan/seqan3/pull/2540/files#r617575294 -#if SEQAN3_WORKAROUND_GCC_100139 - // string_view - if constexpr (is_type_specialisation_of_v, std::basic_string_view>) - { - return urange.substr(begin_pos, static_cast(target_size)); - } - // string const & - else if constexpr (is_type_specialisation_of_v, std::basic_string> - && std::is_const_v>) - { - return std::basic_string_view{std::ranges::data(urange) + begin_pos, static_cast(target_size)}; - } - // contiguous - else if constexpr (std::ranges::borrowed_range && std::ranges::contiguous_range - && std::ranges::sized_range) - { - return std::span{std::ranges::data(urange) + begin_pos, static_cast(target_size)}; - } - // random_access - else if constexpr (std::ranges::borrowed_range && std::ranges::random_access_range - && std::ranges::sized_range) - { - return std::ranges::subrange, std::ranges::iterator_t>{ - std::ranges::begin(urange) + begin_pos, - std::ranges::begin(urange) + end_pos, - static_cast(target_size)}; - } - // std::views::drop - else - { - // urange | drop | take - return std::views::take(std::views::drop(std::forward(urange), begin_pos), target_size); - } -#else /*^^^ workaround / no workaround vvv*/ // urange | type_reduce | drop | take return std::views::take(std::views::drop(seqan3::views::type_reduce(std::forward(urange)), begin_pos), target_size); -#endif // SEQAN3_WORKAROUND_GCC_100139 } }; diff --git a/test/documentation/seqan3_doxygen_cfg.in b/test/documentation/seqan3_doxygen_cfg.in index 4e7388b5b6..57c48fee25 100644 --- a/test/documentation/seqan3_doxygen_cfg.in +++ b/test/documentation/seqan3_doxygen_cfg.in @@ -352,11 +352,9 @@ PREDEFINED = CEREAL_SERIALIZE_FUNCTION_NAME=serialize \ CEREAL_SAVE_MINIMAL_FUNCTION_NAME=save_minimal \ "SEQAN3_DOXYGEN_ONLY(x)= x" \ ${SEQAN3_DOXYGEN_PREDEFINED_NDEBUG} \ - __cpp_lib_three_way_comparison=1 \ SEQAN3_WORKAROUND_LITERAL=constexpr EXPAND_AS_DEFINED = SEQAN3_CPO_OVERLOAD_BODY \ - SEQAN3_CPO_OVERLOAD \ - SEQAN3_WORKAROUND_GCC_114013 + SEQAN3_CPO_OVERLOAD SKIP_FUNCTION_MACROS = NO #--------------------------------------------------------------------------- # Configuration options related to external references diff --git a/test/include/seqan3/test/seqan2.hpp b/test/include/seqan3/test/seqan2.hpp index 57d8e91a20..2dcd855c61 100644 --- a/test/include/seqan3/test/seqan2.hpp +++ b/test/include/seqan3/test/seqan2.hpp @@ -33,7 +33,6 @@ # include -# if __cpp_lib_ranges // C++20 ranges available namespace std { @@ -47,5 +46,5 @@ struct indirectly_readable_traits> }; } // namespace std -# endif //__cpp_lib_ranges -#endif // SEQAN3_HAS_SEQAN2 + +#endif // SEQAN3_HAS_SEQAN2 diff --git a/test/performance/search/search_benchmark.cpp b/test/performance/search/search_benchmark.cpp index e168fcc1ab..ca086d9dfd 100644 --- a/test/performance/search/search_benchmark.cpp +++ b/test/performance/search/search_benchmark.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include #include @@ -140,8 +139,8 @@ std::vector generate_repeating_sequence(size_t const template_length uint8_t simulated_errors = 5; len = (len + simulated_errors > template_length) ? template_length - simulated_errors : len; - return generate_reads(seq_template, repeats, len, simulated_errors, 0.15, 0.15) | seqan3::detail::all - | std::views::join | seqan3::ranges::to(); + return generate_reads(seq_template, repeats, len, simulated_errors, 0.15, 0.15) | std::views::all | std::views::join + | seqan3::ranges::to(); } //============================================================================ diff --git a/test/snippet/core/detail/copyable_wrapper.cpp b/test/snippet/core/detail/copyable_wrapper.cpp deleted file mode 100644 index 5fd49718e2..0000000000 --- a/test/snippet/core/detail/copyable_wrapper.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin -// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik -// SPDX-License-Identifier: CC0-1.0 - -#include -#include - -int main() -{ - int outer{}; - // Might be used for non-copyable lambdas. In this example, the lambda would be copyable even without the wrapper. - seqan3::detail::copyable_wrapper wrapper{[&outer](int const x) - { - outer += x; - return outer; - }}; - auto wrapper_2 = wrapper; // Would not work with non-copyable lambda. - seqan3::debug_stream << wrapper(2) << '\n'; // 2 - seqan3::debug_stream << wrapper_2(4) << '\n'; // 6 -} diff --git a/test/snippet/core/detail/copyable_wrapper.err b/test/snippet/core/detail/copyable_wrapper.err deleted file mode 100644 index 2b24e31277..0000000000 --- a/test/snippet/core/detail/copyable_wrapper.err +++ /dev/null @@ -1,2 +0,0 @@ -2 -6 diff --git a/test/snippet/core/detail/copyable_wrapper.err.license b/test/snippet/core/detail/copyable_wrapper.err.license deleted file mode 100644 index 4251f0f84d..0000000000 --- a/test/snippet/core/detail/copyable_wrapper.err.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin -SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik -SPDX-License-Identifier: CC0-1.0 diff --git a/test/snippet/io/sequence_file/sequence_file_output_view_pipeline.cpp b/test/snippet/io/sequence_file/sequence_file_output_view_pipeline.cpp index fa418543e5..f8219ed35b 100644 --- a/test/snippet/io/sequence_file/sequence_file_output_view_pipeline.cpp +++ b/test/snippet/io/sequence_file/sequence_file_output_view_pipeline.cpp @@ -4,14 +4,13 @@ #include -#if !SEQAN3_WORKAROUND_GCC_96070 //![snippet] -# include -# include -# include +#include +#include +#include -# include -# include +#include +#include auto input = R"(@TEST1 ACGT @@ -51,4 +50,3 @@ int main() | seqan3::sequence_file_output{std::ostringstream{}, seqan3::format_fasta{}}; } //![snippet] -#endif // !SEQAN3_WORKAROUND_GCC_96070 diff --git a/test/unit/alignment/pairwise/alignment_result_test.cpp b/test/unit/alignment/pairwise/alignment_result_test.cpp index 9bc2d15cb7..1303907092 100644 --- a/test/unit/alignment/pairwise/alignment_result_test.cpp +++ b/test/unit/alignment/pairwise/alignment_result_test.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -206,14 +205,14 @@ TYPED_TEST(alignment_result_test, alignment) if constexpr (seqan3::tuple_like) { seqan3::alignment_result tmp{TypeParam{1u, 2u, 0, {10ul, 10ul}, {0ul, 0ul}, {seq, seq}}}; - EXPECT_RANGE_EQ(std::get<0>(tmp.alignment()) | seqan3::detail::all | seqan3::views::to_char, "AT-C--A"sv); - EXPECT_RANGE_EQ(std::get<1>(tmp.alignment()) | seqan3::detail::all | seqan3::views::to_char, "AT-C--A"sv); + EXPECT_RANGE_EQ(std::get<0>(tmp.alignment()) | std::views::all | seqan3::views::to_char, "AT-C--A"sv); + EXPECT_RANGE_EQ(std::get<1>(tmp.alignment()) | std::views::all | seqan3::views::to_char, "AT-C--A"sv); } else { seqan3::alignment_result tmp{TypeParam{1u, 2u, 0, {10ul, 10ul}, {0ul, 0ul}, {seq, seq}}}; - EXPECT_RANGE_EQ(tmp.alignment()[0] | seqan3::detail::all | seqan3::views::to_char, "AT-C--A"sv); - EXPECT_RANGE_EQ(tmp.alignment()[1] | seqan3::detail::all | seqan3::views::to_char, "AT-C--A"sv); + EXPECT_RANGE_EQ(tmp.alignment()[0] | std::views::all | seqan3::views::to_char, "AT-C--A"sv); + EXPECT_RANGE_EQ(tmp.alignment()[1] | std::views::all | seqan3::views::to_char, "AT-C--A"sv); } } diff --git a/test/unit/core/algorithm/detail/algorithm_executor_blocking_test.cpp b/test/unit/core/algorithm/detail/algorithm_executor_blocking_test.cpp index ca5f26c9a9..043d1d9f88 100644 --- a/test/unit/core/algorithm/detail/algorithm_executor_blocking_test.cpp +++ b/test/unit/core/algorithm/detail/algorithm_executor_blocking_test.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include @@ -172,11 +171,11 @@ TYPED_TEST(algorithm_executor_blocking_test, lvalue_sequence_pairs) TYPED_TEST(algorithm_executor_blocking_test, rvalue_sequence_pairs_view) { - using persist_pairs_t = decltype(this->sequence_pairs | seqan3::detail::all); + using persist_pairs_t = decltype(this->sequence_pairs | std::views::all); using algorithm_t = typename algorithm_type_for_input::type; using executor_t = seqan3::detail::algorithm_executor_blocking; - executor_t exec{this->sequence_pairs | seqan3::detail::all, + executor_t exec{this->sequence_pairs | std::views::all, algorithm_t{dummy_algorithm{}}, 0u, this->execution_handler()}; diff --git a/test/unit/core/detail/iterator_traits_test.cpp b/test/unit/core/detail/iterator_traits_test.cpp index 53725733cf..aae909fa51 100644 --- a/test/unit/core/detail/iterator_traits_test.cpp +++ b/test/unit/core/detail/iterator_traits_test.cpp @@ -43,16 +43,13 @@ struct my_iterator : public base_t, public seqan3::detail::maybe_inherited_itera using iterator_concept = seqan3::detail::iterator_concept_tag_t; }; -#ifdef __cpp_lib_ranges // This is C++20 behaviour. TEST(maybe_iterator_category, no_legacy_iterator) { { using view_t = std::ranges::basic_istream_view>; using iterator_t = std::ranges::iterator_t; -# if SEQAN3_WORKAROUND_GCC_96070 // not defined (this is expected for C++20 input iterator) // EXPECT_SAME_TYPE(std::iterator_traits::iterator_category, void); -# endif // SEQAN3_WORKAROUND_GCC_96070 EXPECT_FALSE(has_iterator_category); EXPECT_FALSE(has_iterator_category>); } @@ -60,16 +57,10 @@ TEST(maybe_iterator_category, no_legacy_iterator) { using view_t = std::ranges::basic_istream_view>; using iterator_t = my_iterator>; -# if SEQAN3_WORKAROUND_GCC_96070 - // our workaround - EXPECT_SAME_TYPE(std::iterator_traits::iterator_category, void); -# else // ^^^ workaround / no workaround vvv EXPECT_FALSE(has_iterator_category); EXPECT_FALSE(has_iterator_category>); -# endif // SEQAN3_WORKAROUND_GCC_96070 } } -#endif // __cpp_lib_ranges TEST(maybe_iterator_category, output_iterator_tag) { @@ -82,11 +73,7 @@ TEST(maybe_iterator_category, output_iterator_tag) { using iterator_t = std::ostream_iterator; EXPECT_SAME_TYPE(std::iterator_traits::iterator_category, std::output_iterator_tag); -#if defined(__cpp_lib_ranges) EXPECT_SAME_TYPE(iterator_t::iterator_category, std::output_iterator_tag); -#else // ^^^ >= C++20 / < C++20 vvv - EXPECT_FALSE(has_iterator_category); -#endif } } @@ -98,7 +85,6 @@ TEST(maybe_iterator_category, input_iterator_tag) EXPECT_SAME_TYPE(iterator_t::iterator_category, std::input_iterator_tag); } -#ifdef __cpp_lib_ranges { // std::views::transform will drop the iterator_category if the lambda doesn't return a lvalue. // This is C++20 behaviour. @@ -112,7 +98,6 @@ TEST(maybe_iterator_category, input_iterator_tag) EXPECT_SAME_TYPE(std::iterator_traits::iterator_category, std::input_iterator_tag); EXPECT_SAME_TYPE(iterator_t::iterator_category, std::input_iterator_tag); } -#endif // __cpp_lib_ranges } TEST(maybe_iterator_category, forward_iterator_tag) @@ -316,9 +301,5 @@ TEST(iterator_concept_tag_t, contiguous_iterator_tag) using range_t = std::vector; using iterator_t = std::ranges::iterator_t; EXPECT_SAME_TYPE(seqan3::detail::iterator_concept_tag_t, std::contiguous_iterator_tag); -#if defined(__cpp_lib_ranges) EXPECT_SAME_TYPE(iterator_t::iterator_concept, std::contiguous_iterator_tag); -#else // ^^^ >= C++20 / < C++20 vvv - EXPECT_FALSE(has_iterator_concept); -#endif } diff --git a/test/unit/io/sequence_file/sequence_file_integration_test.cpp b/test/unit/io/sequence_file/sequence_file_integration_test.cpp index 312a4734be..ba1945aa37 100644 --- a/test/unit/io/sequence_file/sequence_file_integration_test.cpp +++ b/test/unit/io/sequence_file/sequence_file_integration_test.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include @@ -100,11 +99,11 @@ TEST(integration, view) "AGGCTGNAGGCTGAGGCTGNAGGCTGNAGGCTGNAGGCTGNAGGCTGNAGGCTGNAGGCTGN\n"}; // valid without assignment? - seqan3::sequence_file_input{std::istringstream{input}, seqan3::format_fasta{}} | seqan3::detail::all + seqan3::sequence_file_input{std::istringstream{input}, seqan3::format_fasta{}} | std::views::all | std::views::take(2) | seqan3::sequence_file_output{std::ostringstream{}, seqan3::format_fasta{}}; // valid with assignment and check contents - auto fout = seqan3::sequence_file_input{std::istringstream{input}, seqan3::format_fasta{}} | seqan3::detail::all + auto fout = seqan3::sequence_file_input{std::istringstream{input}, seqan3::format_fasta{}} | std::views::all | std::views::take(2) | seqan3::sequence_file_output{std::ostringstream{}, seqan3::format_fasta{}}; fout.get_stream().flush(); diff --git a/test/unit/search/search_collection_test.cpp b/test/unit/search/search_collection_test.cpp index e672ba597f..c94ce4423c 100644 --- a/test/unit/search/search_collection_test.cpp +++ b/test/unit/search/search_collection_test.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -24,13 +23,13 @@ using seqan3::operator""_phred42; using namespace std::string_literals; -auto ref_id_and_position = seqan3::detail::all +auto ref_id_and_position = std::views::all | std::views::transform( [](auto && res) { return std::make_pair(res.reference_id(), res.reference_begin_position()); }); -auto query_id = seqan3::detail::all +auto query_id = std::views::all | std::views::transform( [](auto && res) { diff --git a/test/unit/search/search_test.cpp b/test/unit/search/search_test.cpp index 8ffa8a46e5..846ed41128 100644 --- a/test/unit/search/search_test.cpp +++ b/test/unit/search/search_test.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -26,13 +25,13 @@ using seqan3::operator""_phred42; using namespace std::string_literals; -auto position = seqan3::detail::all +auto position = std::views::all | std::views::transform( [](auto && res) { return res.reference_begin_position(); }); -auto query_id = seqan3::detail::all +auto query_id = std::views::all | std::views::transform( [](auto && res) { diff --git a/test/unit/utility/views/single_pass_input_test.cpp b/test/unit/utility/views/single_pass_input_test.cpp index 04fbf97000..9b150b5b41 100644 --- a/test/unit/utility/views/single_pass_input_test.cpp +++ b/test/unit/utility/views/single_pass_input_test.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -58,7 +57,7 @@ TYPED_TEST_SUITE(single_pass_input, underlying_range_types, ); TYPED_TEST(single_pass_input, view_concept) { - using view_t = seqan3::detail::single_pass_input_view>; + using view_t = seqan3::detail::single_pass_input_view>; EXPECT_TRUE((std::derived_from>)); EXPECT_TRUE((std::sentinel_for, std::ranges::iterator_t>)); EXPECT_TRUE(std::ranges::range); @@ -112,7 +111,7 @@ TYPED_TEST(single_pass_input, deduction_guide_view) TYPED_TEST(single_pass_input, view_construction) { - using view_t = seqan3::detail::single_pass_input_view>; + using view_t = seqan3::detail::single_pass_input_view>; EXPECT_TRUE(std::is_default_constructible_v); EXPECT_TRUE(std::is_copy_constructible_v); EXPECT_TRUE(std::is_move_constructible_v); @@ -126,7 +125,7 @@ TYPED_TEST(single_pass_input, view_construction) } { // from view - [[maybe_unused]] seqan3::detail::single_pass_input_view v{TypeParam{this->data} | seqan3::detail::all}; + [[maybe_unused]] seqan3::detail::single_pass_input_view v{TypeParam{this->data} | std::views::all}; } } @@ -177,14 +176,14 @@ TYPED_TEST(single_pass_input, view_iterate) TYPED_TEST(single_pass_input, iterator_concepts) { - using view_type = seqan3::detail::single_pass_input_view>; + using view_type = seqan3::detail::single_pass_input_view>; EXPECT_TRUE((std::input_iterator>)); EXPECT_FALSE((std::forward_iterator>)); } TYPED_TEST(single_pass_input, iterator_construction) { - using view_type = seqan3::detail::single_pass_input_view>; + using view_type = seqan3::detail::single_pass_input_view>; using iterator_type = std::ranges::iterator_t; EXPECT_TRUE(std::is_default_constructible_v); EXPECT_TRUE(std::is_copy_constructible_v); @@ -289,7 +288,7 @@ TYPED_TEST(single_pass_input, iterator_neq_comparison) TYPED_TEST(single_pass_input, sentinel_concepts) { - using view_type = seqan3::detail::single_pass_input_view>; + using view_type = seqan3::detail::single_pass_input_view>; using iterator_type = std::ranges::iterator_t; using sentinel_type = std::ranges::sentinel_t;