From edaa5774ce194ae4bfc8074ab62f267023090267 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Fri, 25 Aug 2023 13:18:09 +0200 Subject: [PATCH] Squashed 'include/hibf/contrib/std/' changes from 403e4e5..8bf6a49 8bf6a49 [MISC] Use std:: instead of ::std:: 95641d1 [MISC] Rename seqan::std to seqan::stl 15964b1 [FIX] missing include git-subtree-dir: include/hibf/contrib/std git-subtree-split: 8bf6a492ed8098877f9080dbd40b3d9fc012d225 --- all_view.hpp | 112 ++--- chunk_view.hpp | 338 ++++++------- concepts.hpp | 26 +- detail/adaptor_base.hpp | 65 ++- detail/adaptor_for_view_without_args.hpp | 8 +- detail/adaptor_from_functor.hpp | 14 +- detail/compiler_definitions.hpp | 2 +- detail/exposition_only.hpp | 16 +- detail/non_propagating_cache.hpp | 22 +- join_with_view.hpp | 348 +++++++------ pair.hpp | 339 +++++++------ to.hpp | 162 +++---- tuple.hpp | 594 +++++++++++------------ zip_view.hpp | 341 +++++++------ 14 files changed, 1187 insertions(+), 1200 deletions(-) diff --git a/all_view.hpp b/all_view.hpp index fee45f49..8fc230d9 100644 --- a/all_view.hpp +++ b/all_view.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::views::{all, all_t}, and seqan::std::ranges::owning_view. + * \brief Provides seqan::stl::views::{all, all_t}, and seqan::stl::ranges::owning_view. */ // File might be included from multiple libraries. @@ -18,34 +18,34 @@ #if __cpp_lib_ranges >= 202110L -namespace seqan::std::ranges +namespace seqan::stl::ranges { -using ::std::ranges::owning_view; +using std::ranges::owning_view; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::views +namespace seqan::stl::views { -using ::std::ranges::views::all; -using ::std::ranges::views::all_t; +using std::ranges::views::all; +using std::ranges::views::all_t; -} // namespace seqan::std::views +} // namespace seqan::stl::views #else # include "concepts.hpp" # include "detail/adaptor_base.hpp" # include "detail/exposition_only.hpp" -namespace seqan::std::ranges +namespace seqan::stl::ranges { /*!\brief A move-only view that takes unique ownership of a range. * \sa https://en.cppreference.com/w/cpp/ranges/owning_view */ -template <::std::ranges::range rng_t> - requires ::std::movable && (!seqan::std::detail::is_initializer_list<::std::remove_cvref_t>) -class owning_view : public ::std::ranges::view_interface> +template + requires std::movable && (!seqan::stl::detail::is_initializer_list>) +class owning_view : public std::ranges::view_interface> { private: //!\brief The stored range. @@ -53,7 +53,7 @@ class owning_view : public ::std::ranges::view_interface> public: owning_view() - requires ::std::default_initializable + requires std::default_initializable = default; //!< Defaulted. owning_view(owning_view const &) = delete; //!< Deleted. owning_view & operator=(owning_view const &) = delete; //!< Deleted. @@ -62,7 +62,7 @@ class owning_view : public ::std::ranges::view_interface> ~owning_view() = default; //!< Defaulted. //!\brief Move construct from a range. - constexpr owning_view(rng_t && r) : rng(::std::move(r)) + constexpr owning_view(rng_t && r) : rng(std::move(r)) {} //!\brief Returns the range. @@ -80,145 +80,145 @@ class owning_view : public ::std::ranges::view_interface> //!\overload constexpr rng_t && base() && noexcept { - return ::std::move(rng); + return std::move(rng); } //!\overload constexpr rng_t const && base() const && noexcept { - return ::std::move(rng); + return std::move(rng); } //!\brief Return the begin iterator of the range. - constexpr ::std::ranges::iterator_t begin() + constexpr std::ranges::iterator_t begin() { - return ::std::ranges::begin(rng); + return std::ranges::begin(rng); } //!\overload constexpr auto begin() const - requires ::std::ranges::range + requires std::ranges::range { - return ::std::ranges::begin(rng); + return std::ranges::begin(rng); } //!\brief Return the end iterator of the range. - constexpr ::std::ranges::sentinel_t end() + constexpr std::ranges::sentinel_t end() { - return ::std::ranges::end(rng); + return std::ranges::end(rng); } //!\overload constexpr auto end() const - requires ::std::ranges::range + requires std::ranges::range { - return ::std::ranges::end(rng); + return std::ranges::end(rng); } //!\brief Checks whether the range is empty. constexpr bool empty() - requires requires { ::std::ranges::empty(rng); } + requires requires { std::ranges::empty(rng); } { - return ::std::ranges::empty(rng); + return std::ranges::empty(rng); } //!\overload constexpr bool empty() const - requires requires { ::std::ranges::empty(rng); } + requires requires { std::ranges::empty(rng); } { - return ::std::ranges::empty(rng); + return std::ranges::empty(rng); } //!\brief Returns the size of the range. constexpr auto size() - requires ::std::ranges::sized_range + requires std::ranges::sized_range { - return ::std::ranges::size(rng); + return std::ranges::size(rng); } //!\overload constexpr auto size() const - requires ::std::ranges::sized_range + requires std::ranges::sized_range { - return ::std::ranges::size(rng); + return std::ranges::size(rng); } //!\brief Returns the raw data pointer of the range. constexpr auto data() - requires ::std::ranges::contiguous_range + requires std::ranges::contiguous_range { - return ::std::ranges::data(rng); + return std::ranges::data(rng); } //!\overload constexpr auto data() const - requires ::std::ranges::contiguous_range + requires std::ranges::contiguous_range { - return ::std::ranges::data(rng); + return std::ranges::data(rng); } }; -/*!\brief The functor for seqan::std::views::all. +/*!\brief The functor for seqan::stl::views::all. */ -class all_fn : public seqan::std::detail::adaptor_base +class all_fn : public seqan::stl::detail::adaptor_base { private: //!\brief Befriend the base class. - friend seqan::std::detail::adaptor_base; + friend seqan::stl::detail::adaptor_base; //!\brief Checks whether a type is a view. template - static constexpr bool decays_to_view = ::std::ranges::view<::std::decay_t>; + static constexpr bool decays_to_view = std::ranges::view>; - //!\brief Checks whether a type could be used for ::std::ranges::ref_view. + //!\brief Checks whether a type could be used for std::ranges::ref_view. template - static constexpr bool valid_for_ref_view = requires { ::std::ranges::ref_view(::std::declval()); }; + static constexpr bool valid_for_ref_view = requires { std::ranges::ref_view(std::declval()); }; //!\brief Checks whether a type could be used for seqan3::detail::owning_view. template - static constexpr bool valid_for_owning_view = requires { owning_view(::std::declval()); }; + static constexpr bool valid_for_owning_view = requires { owning_view(std::declval()); }; public: - using seqan::std::detail::adaptor_base::adaptor_base; + using seqan::stl::detail::adaptor_base::adaptor_base; /*!\brief Returns a view that includes all elements of the range argument. * \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. + * 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. + * * A std::ranges::ref_view of `rng` if that expression is valid. * * Otherwise, a seqan3::detail::owning_view of `rng`. */ - template + template requires decays_to_view || valid_for_ref_view || valid_for_owning_view static auto impl(rng_t && rng) { if constexpr (decays_to_view) - return ::std::forward(rng); + return std::forward(rng); else if constexpr (valid_for_ref_view) - return ::std::ranges::ref_view{::std::forward(rng)}; + return std::ranges::ref_view{std::forward(rng)}; else - return owning_view{::std::forward(rng)}; + return owning_view{std::forward(rng)}; } }; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::views +namespace seqan::stl::views { /*!\copydoc all_fn::impl */ -inline constexpr auto all = seqan::std::ranges::all_fn{}; +inline constexpr auto all = seqan::stl::ranges::all_fn{}; /*!\brief Returns the type that results from appying seqan3::detail::all to a range. */ -template -using all_t = decltype(all(::std::declval())); +template +using all_t = decltype(all(std::declval())); -} // namespace seqan::std::views +} // namespace seqan::stl::views #endif // __cpp_lib_ranges >= 202110L diff --git a/chunk_view.hpp b/chunk_view.hpp index 33967a0d..56cc7d07 100644 --- a/chunk_view.hpp +++ b/chunk_view.hpp @@ -7,23 +7,24 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::views::chunk. + * \brief Provides seqan::stl::views::chunk. */ // File might be included from multiple libraries. #ifndef SEQAN_STD_CHUNK_VIEW #define SEQAN_STD_CHUNK_VIEW +#include #include #ifdef __cpp_lib_ranges_chunk -namespace seqan::std::views +namespace seqan::stl::views { -using ::std::ranges::views::chunk; +using std::ranges::views::chunk; -} // namespace seqan::std::views +} // namespace seqan::stl::views #else @@ -36,7 +37,7 @@ using ::std::ranges::views::chunk; # include "detail/exposition_only.hpp" # include "detail/non_propagating_cache.hpp" -namespace seqan::std::detail::chunk +namespace seqan::stl::detail::chunk { template @@ -48,32 +49,32 @@ constexpr I div_ceil(I num, I denom) return r; } -template <::std::integral T> +template constexpr auto to_unsigned_like(T v) noexcept { - return static_cast<::std::make_unsigned_t>(v); + return static_cast>(v); } -} // namespace seqan::std::detail::chunk +} // namespace seqan::stl::detail::chunk -namespace seqan::std::ranges +namespace seqan::stl::ranges { -template <::std::ranges::view V> +template class chunk_view; -template <::std::ranges::view V> - requires ::std::ranges::input_range -class chunk_view : public ::std::ranges::view_interface> +template + requires std::ranges::input_range +class chunk_view : public std::ranges::view_interface> { // clang-format off SEQAN_STD_NESTED_VISIBILITY // clang-format on V base_; - ::std::ranges::range_difference_t n_; - ::std::ranges::range_difference_t remainder_ = 0; + std::ranges::range_difference_t n_; + std::ranges::range_difference_t remainder_ = 0; - seqan::std::detail::non_propagating_cache<::std::ranges::iterator_t> current_; + seqan::stl::detail::non_propagating_cache> current_; private: class outer_iterator; @@ -82,67 +83,67 @@ SEQAN_STD_NESTED_VISIBILITY public: chunk_view() - requires ::std::default_initializable + requires std::default_initializable = default; - constexpr explicit chunk_view(V base, ::std::ranges::range_difference_t n) : base_{::std::move(base)}, n_{n} + constexpr explicit chunk_view(V base, std::ranges::range_difference_t n) : base_{std::move(base)}, n_{n} { assert(n > 0); } constexpr V base() const & - requires ::std::copy_constructible + requires std::copy_constructible { return base_; } constexpr V base() && { - return ::std::move(base_); + return std::move(base_); } constexpr outer_iterator begin() { - current_ = ::std::ranges::begin(base_); + current_ = std::ranges::begin(base_); remainder_ = n_; return outer_iterator{*this}; } - constexpr ::std::default_sentinel_t end() const noexcept + constexpr std::default_sentinel_t end() const noexcept { - return ::std::default_sentinel; + return std::default_sentinel; } constexpr auto size() - requires ::std::ranges::sized_range + requires std::ranges::sized_range { - return seqan::std::detail::chunk::to_unsigned_like( - seqan::std::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); + return seqan::stl::detail::chunk::to_unsigned_like( + seqan::stl::detail::chunk::div_ceil(std::ranges::distance(base_), n_)); } constexpr auto size() const - requires ::std::ranges::sized_range + requires std::ranges::sized_range { - return seqan::std::detail::chunk::to_unsigned_like( - seqan::std::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); + return seqan::stl::detail::chunk::to_unsigned_like( + seqan::stl::detail::chunk::div_ceil(std::ranges::distance(base_), n_)); } }; template -chunk_view(R &&, ::std::ranges::range_difference_t) -> chunk_view>; +chunk_view(R &&, std::ranges::range_difference_t) -> chunk_view>; -template <::std::ranges::view V> - requires ::std::ranges::input_range +template + requires std::ranges::input_range class chunk_view::outer_iterator { private: chunk_view * parent_; - constexpr explicit outer_iterator(chunk_view & parent) : parent_{::std::addressof(parent)} + constexpr explicit outer_iterator(chunk_view & parent) : parent_{std::addressof(parent)} {} friend chunk_view; public: - using iterator_concept = ::std::input_iterator_tag; - using difference_type = ::std::ranges::range_difference_t; + using iterator_concept = std::input_iterator_tag; + using difference_type = std::ranges::range_difference_t; struct value_type; @@ -151,13 +152,13 @@ class chunk_view::outer_iterator constexpr value_type operator*() const { - assert(*this != ::std::default_sentinel); + assert(*this != std::default_sentinel); return value_type(*parent_); } constexpr outer_iterator & operator++() { - assert(*this != ::std::default_sentinel); - ::std::ranges::advance(*parent_->current_, parent_->remainder_, ::std::ranges::end(parent_->base_)); + assert(*this != std::default_sentinel); + std::ranges::advance(*parent_->current_, parent_->remainder_, std::ranges::end(parent_->base_)); parent_->remainder_ = parent_->n_; return *this; } @@ -166,36 +167,36 @@ class chunk_view::outer_iterator ++*this; } - friend constexpr bool operator==(outer_iterator const & x, ::std::default_sentinel_t) + friend constexpr bool operator==(outer_iterator const & x, std::default_sentinel_t) { - return *x.parent_->current_ == ::std::ranges::end(x.parent_->base_) && x.parent_->remainder_ != 0; + return *x.parent_->current_ == std::ranges::end(x.parent_->base_) && x.parent_->remainder_ != 0; } - friend constexpr difference_type operator-(::std::default_sentinel_t y, outer_iterator const & x) - requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> + friend constexpr difference_type operator-(std::default_sentinel_t y, outer_iterator const & x) + requires std::sized_sentinel_for, std::ranges::iterator_t> { - auto const dist = ::std::ranges::end(x.parent_->base_) - *x.parent_->current_; + auto const dist = std::ranges::end(x.parent_->base_) - *x.parent_->current_; if (dist < x.parent_->remainder_) { return dist == 0 ? 0 : 1; } - return seqan::std::detail::chunk::div_ceil(dist - x.parent_->remainder_, x.parent_->n_) + 1; + return seqan::stl::detail::chunk::div_ceil(dist - x.parent_->remainder_, x.parent_->n_) + 1; } - friend constexpr difference_type operator-(outer_iterator const & x, ::std::default_sentinel_t y) - requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> + friend constexpr difference_type operator-(outer_iterator const & x, std::default_sentinel_t y) + requires std::sized_sentinel_for, std::ranges::iterator_t> { return -(y - x); } }; -template <::std::ranges::view V> - requires ::std::ranges::input_range -struct chunk_view::outer_iterator::value_type : ::std::ranges::view_interface +template + requires std::ranges::input_range +struct chunk_view::outer_iterator::value_type : std::ranges::view_interface { private: chunk_view * parent_; - constexpr explicit value_type(chunk_view & parent) noexcept : parent_{::std::addressof(parent)} + constexpr explicit value_type(chunk_view & parent) noexcept : parent_{std::addressof(parent)} {} friend chunk_view; @@ -205,54 +206,54 @@ struct chunk_view::outer_iterator::value_type : ::std::ranges::view_interface { return inner_iterator{*parent_}; } - constexpr ::std::default_sentinel_t end() const noexcept + constexpr std::default_sentinel_t end() const noexcept { - return ::std::default_sentinel; + return std::default_sentinel; } constexpr auto size() const - requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> + requires std::sized_sentinel_for, std::ranges::iterator_t> { - return seqan::std::detail::chunk::to_unsigned_like( - ::std::ranges::min(parent_->remainder_, ::std::ranges::end(parent_->base_) - *parent_->current_)); + return seqan::stl::detail::chunk::to_unsigned_like( + std::ranges::min(parent_->remainder_, std::ranges::end(parent_->base_) - *parent_->current_)); } }; -template <::std::ranges::view V> - requires ::std::ranges::input_range +template + requires std::ranges::input_range class chunk_view::inner_iterator { private: chunk_view * parent_; - constexpr explicit inner_iterator(chunk_view & parent) noexcept : parent_{::std::addressof(parent)} + constexpr explicit inner_iterator(chunk_view & parent) noexcept : parent_{std::addressof(parent)} {} friend chunk_view; public: - using iterator_concept = ::std::input_iterator_tag; - using difference_type = ::std::ranges::range_difference_t; - using value_type = ::std::ranges::range_value_t; + using iterator_concept = std::input_iterator_tag; + using difference_type = std::ranges::range_difference_t; + using value_type = std::ranges::range_value_t; inner_iterator(inner_iterator &&) = default; inner_iterator & operator=(inner_iterator &&) = default; - constexpr ::std::ranges::iterator_t const & base() const & + constexpr std::ranges::iterator_t const & base() const & { return *parent_->current_; } - constexpr ::std::ranges::range_reference_t operator*() const + constexpr std::ranges::range_reference_t operator*() const { - assert(*this != ::std::default_sentinel); + assert(*this != std::default_sentinel); return **parent_->current_; } constexpr inner_iterator & operator++() { - assert(*this != ::std::default_sentinel); + assert(*this != std::default_sentinel); ++*parent_->current_; - if (*parent_->current_ == ::std::ranges::end(parent_->base_)) + if (*parent_->current_ == std::ranges::end(parent_->base_)) parent_->remainder_ = 0; else --parent_->remainder_; @@ -263,148 +264,148 @@ class chunk_view::inner_iterator return ++*this; } - friend constexpr bool operator==(inner_iterator const & x, ::std::default_sentinel_t) + friend constexpr bool operator==(inner_iterator const & x, std::default_sentinel_t) { return x.parent_->remainder_ == 0; } - friend constexpr difference_type operator-(::std::default_sentinel_t y, inner_iterator const & x) - requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> + friend constexpr difference_type operator-(std::default_sentinel_t y, inner_iterator const & x) + requires std::sized_sentinel_for, std::ranges::iterator_t> { - ::std::ranges::min(x.parent_->remainder_, ::std::ranges::end(x.parent_->base_) - *x.parent_->current_); + std::ranges::min(x.parent_->remainder_, std::ranges::end(x.parent_->base_) - *x.parent_->current_); } - friend constexpr difference_type operator-(inner_iterator const & x, ::std::default_sentinel_t y) - requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> + friend constexpr difference_type operator-(inner_iterator const & x, std::default_sentinel_t y) + requires std::sized_sentinel_for, std::ranges::iterator_t> { return -(y - x); } - friend constexpr ::std::ranges::range_rvalue_reference_t - iter_move(inner_iterator const & i) noexcept(noexcept(::std::ranges::iter_move(*i.parent_->current_))) + friend constexpr std::ranges::range_rvalue_reference_t + iter_move(inner_iterator const & i) noexcept(noexcept(std::ranges::iter_move(*i.parent_->current_))) { - return ::std::ranges::iter_move(*i.parent_->current_); + return std::ranges::iter_move(*i.parent_->current_); } friend constexpr void iter_swap(inner_iterator const & x, inner_iterator const & y) noexcept( - noexcept(::std::ranges::iter_swap(*x.parent_->current_, *y.parent_->current_))) - requires ::std::indirectly_swappable<::std::ranges::iterator_t> + noexcept(std::ranges::iter_swap(*x.parent_->current_, *y.parent_->current_))) + requires std::indirectly_swappable> { - ::std::ranges::iter_swap(*x.parent_->current_, *y.parent_->current_); + std::ranges::iter_swap(*x.parent_->current_, *y.parent_->current_); } }; -template <::std::ranges::view V> - requires ::std::ranges::forward_range -class chunk_view : public ::std::ranges::view_interface> +template + requires std::ranges::forward_range +class chunk_view : public std::ranges::view_interface> { private: V base_; - ::std::ranges::range_difference_t n_; + std::ranges::range_difference_t n_; template class iterator; public: chunk_view() - requires ::std::default_initializable + requires std::default_initializable = default; - constexpr explicit chunk_view(V base, ::std::ranges::range_difference_t n) : base_{::std::move(base)}, n_{n} + constexpr explicit chunk_view(V base, std::ranges::range_difference_t n) : base_{std::move(base)}, n_{n} { assert(n > 0); } constexpr V base() const & - requires ::std::copy_constructible + requires std::copy_constructible { return base_; } constexpr V base() && { - return ::std::move(base_); + return std::move(base_); } constexpr auto begin() - requires (!seqan::std::detail::simple_view) + requires (!seqan::stl::detail::simple_view) { - return iterator{this, ::std::ranges::begin(base_)}; + return iterator{this, std::ranges::begin(base_)}; } constexpr auto begin() const - requires ::std::ranges::forward_range + requires std::ranges::forward_range { - return iterator{this, ::std::ranges::begin(base_)}; + return iterator{this, std::ranges::begin(base_)}; } constexpr auto end() - requires (!seqan::std::detail::simple_view) + requires (!seqan::stl::detail::simple_view) { - if constexpr (::std::ranges::common_range && ::std::ranges::sized_range) + if constexpr (std::ranges::common_range && std::ranges::sized_range) { - auto missing = (n_ - ::std::ranges::distance(base_) % n_) % n_; - return iterator{this, ::std::ranges::end(base_), missing}; + auto missing = (n_ - std::ranges::distance(base_) % n_) % n_; + return iterator{this, std::ranges::end(base_), missing}; } - else if constexpr (::std::ranges::common_range && !::std::ranges::bidirectional_range) + else if constexpr (std::ranges::common_range && !std::ranges::bidirectional_range) { - return iterator{this, ::std::ranges::end(base_)}; + return iterator{this, std::ranges::end(base_)}; } else { - return ::std::default_sentinel; + return std::default_sentinel; } } constexpr auto end() const - requires ::std::ranges::forward_range + requires std::ranges::forward_range { - if constexpr (::std::ranges::common_range && ::std::ranges::sized_range) + if constexpr (std::ranges::common_range && std::ranges::sized_range) { - auto missing = (n_ - ::std::ranges::distance(base_) % n_) % n_; - return iterator{this, ::std::ranges::end(base_), missing}; + auto missing = (n_ - std::ranges::distance(base_) % n_) % n_; + return iterator{this, std::ranges::end(base_), missing}; } - else if constexpr (::std::ranges::common_range && !::std::ranges::bidirectional_range) + else if constexpr (std::ranges::common_range && !std::ranges::bidirectional_range) { - return iterator{this, ::std::ranges::end(base_)}; + return iterator{this, std::ranges::end(base_)}; } else { - return ::std::default_sentinel; + return std::default_sentinel; } } constexpr auto size() - requires ::std::ranges::sized_range + requires std::ranges::sized_range { - return seqan::std::detail::chunk::to_unsigned_like( - seqan::std::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); + return seqan::stl::detail::chunk::to_unsigned_like( + seqan::stl::detail::chunk::div_ceil(std::ranges::distance(base_), n_)); } constexpr auto size() const - requires ::std::ranges::sized_range + requires std::ranges::sized_range { - return seqan::std::detail::chunk::to_unsigned_like( - seqan::std::detail::chunk::div_ceil(::std::ranges::distance(base_), n_)); + return seqan::stl::detail::chunk::to_unsigned_like( + seqan::stl::detail::chunk::div_ceil(std::ranges::distance(base_), n_)); } }; -template <::std::ranges::view V> - requires ::std::ranges::forward_range +template + requires std::ranges::forward_range template class chunk_view::iterator { private: - using Parent = seqan::std::detail::maybe_const; - using Base = seqan::std::detail::maybe_const; + using Parent = seqan::stl::detail::maybe_const; + using Base = seqan::stl::detail::maybe_const; - ::std::ranges::iterator_t current_ = ::std::ranges::iterator_t{}; - ::std::ranges::sentinel_t end_ = ::std::ranges::sentinel_t{}; - ::std::ranges::range_difference_t n_ = 0; - ::std::ranges::range_difference_t missing_ = 0; + std::ranges::iterator_t current_ = std::ranges::iterator_t{}; + std::ranges::sentinel_t end_ = std::ranges::sentinel_t{}; + std::ranges::range_difference_t n_ = 0; + std::ranges::range_difference_t missing_ = 0; constexpr iterator(Parent * parent, - ::std::ranges::iterator_t current, - ::std::ranges::range_difference_t missing = 0) : + std::ranges::iterator_t current, + std::ranges::range_difference_t missing = 0) : current_{current}, - end_{::std::ranges::end(parent->base_)}, + end_{std::ranges::end(parent->base_)}, n_{parent->n_}, missing_{missing} {} @@ -412,23 +413,23 @@ class chunk_view::iterator friend chunk_view; public: - using iterator_category = ::std::input_iterator_tag; - using iterator_concept = ::std::conditional_t<::std::ranges::random_access_range, - ::std::random_access_iterator_tag, - ::std::conditional_t<::std::ranges::bidirectional_range, - ::std::bidirectional_iterator_tag, - ::std::forward_iterator_tag>>; - using value_type = decltype(::std::views::take(::std::ranges::subrange{current_, end_}, n_)); - using difference_type = ::std::ranges::range_difference_t; + using iterator_category = std::input_iterator_tag; + using iterator_concept = std::conditional_t, + std::random_access_iterator_tag, + std::conditional_t, + std::bidirectional_iterator_tag, + std::forward_iterator_tag>>; + using value_type = decltype(std::views::take(std::ranges::subrange{current_, end_}, n_)); + using difference_type = std::ranges::range_difference_t; iterator() = default; constexpr iterator(iterator i) - requires Const && ::std::convertible_to<::std::ranges::iterator_t, ::std::ranges::iterator_t> - && ::std::convertible_to<::std::ranges::sentinel_t, ::std::ranges::sentinel_t> - : current_{::std::move(i.current_)}, end_{::std::move(i.end_)}, n_{i.n_}, missing_{i.missing_} + requires Const && std::convertible_to, std::ranges::iterator_t> + && std::convertible_to, std::ranges::sentinel_t> + : current_{std::move(i.current_)}, end_{std::move(i.end_)}, n_{i.n_}, missing_{i.missing_} {} - constexpr ::std::ranges::iterator_t base() const + constexpr std::ranges::iterator_t base() const { return current_; } @@ -436,13 +437,13 @@ class chunk_view::iterator constexpr value_type operator*() const { assert(current_ != end_); - return ::std::views::take(::std::ranges::subrange(current_, end_), n_); + return std::views::take(std::ranges::subrange(current_, end_), n_); } constexpr iterator & operator++() { assert(current_ != end_); - missing_ = ::std::ranges::advance(current_, n_, end_); + missing_ = std::ranges::advance(current_, n_, end_); return *this; } @@ -454,15 +455,15 @@ class chunk_view::iterator } constexpr iterator & operator--() - requires ::std::ranges::bidirectional_range + requires std::ranges::bidirectional_range { - ::std::ranges::advance(current_, missing_ - n_); + std::ranges::advance(current_, missing_ - n_); missing_ = 0; return *this; } constexpr iterator operator--(int) - requires ::std::ranges::bidirectional_range + requires std::ranges::bidirectional_range { auto tmp = *this; --*this; @@ -470,30 +471,30 @@ class chunk_view::iterator } constexpr iterator & operator+=(difference_type x) - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { - assert(x <= 0 || ::std::ranges::distance(current_, end_) > n_ * (x - 1)); + assert(x <= 0 || std::ranges::distance(current_, end_) > n_ * (x - 1)); if (x > 0) { - ::std::ranges::advance(current_, n_ * (x - 1)); - missing_ = ::std::ranges::advance(current_, n_, end_); + std::ranges::advance(current_, n_ * (x - 1)); + missing_ = std::ranges::advance(current_, n_, end_); } else if (x < 0) { - ::std::ranges::advance(current_, n_ * x + missing_); + std::ranges::advance(current_, n_ * x + missing_); missing_ = 0; } return *this; } constexpr iterator & operator-=(difference_type x) - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { return *this += -x; } constexpr value_type operator[](difference_type n) const - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { return *(*this + n); } @@ -503,46 +504,45 @@ class chunk_view::iterator return x.current_ == y.current_; } - friend constexpr bool operator==(iterator const & x, ::std::default_sentinel_t) + friend constexpr bool operator==(iterator const & x, std::default_sentinel_t) { return x.current_ == x.end_; } friend constexpr bool operator<(iterator const & x, iterator const & y) - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { return x.current_ < y.current_; } friend constexpr bool operator>(iterator const & x, iterator const & y) - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { return y < x; } friend constexpr bool operator<=(iterator const & x, iterator const & y) - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { return !(y < x); } friend constexpr bool operator>=(iterator const & x, iterator const & y) - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { return !(x < y); } # ifdef __cpp_lib_three_way_comparison friend constexpr auto operator<=>(iterator const & x, iterator const & y) - requires ::std::ranges::random_access_range - && ::std::three_way_comparable<::std::ranges::iterator_t> + requires std::ranges::random_access_range && std::three_way_comparable> { return x.current_ <=> y.current_; } # endif friend constexpr iterator operator+(iterator const & i, difference_type n) - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { auto r = i; r += n; @@ -550,7 +550,7 @@ class chunk_view::iterator } friend constexpr iterator operator+(difference_type n, iterator const & i) - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { auto r = i; r += n; @@ -558,7 +558,7 @@ class chunk_view::iterator } friend constexpr iterator operator-(iterator const & i, difference_type n) - requires ::std::ranges::random_access_range + requires std::ranges::random_access_range { auto r = i; r -= n; @@ -566,19 +566,19 @@ class chunk_view::iterator } friend constexpr difference_type operator-(iterator const & x, iterator const & y) - requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> + requires std::sized_sentinel_for, std::ranges::iterator_t> { return (x.current_ - y.current_ + x.missing_ - y.missing_) / x.n_; } - friend constexpr difference_type operator-(::std::default_sentinel_t y, iterator const & x) - requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> + friend constexpr difference_type operator-(std::default_sentinel_t y, iterator const & x) + requires std::sized_sentinel_for, std::ranges::iterator_t> { - return seqan::std::detail::chunk::div_ceil(x.end_ - x.current_, x.n_); + return seqan::stl::detail::chunk::div_ceil(x.end_ - x.current_, x.n_); } - friend constexpr difference_type operator-(iterator const & x, ::std::default_sentinel_t y) - requires ::std::sized_sentinel_for<::std::ranges::sentinel_t, ::std::ranges::iterator_t> + friend constexpr difference_type operator-(iterator const & x, std::default_sentinel_t y) + requires std::sized_sentinel_for, std::ranges::iterator_t> { return -(y - x); } @@ -589,24 +589,24 @@ struct chunk_fn template constexpr auto operator()(Difference n) const { - return seqan::std::detail::adaptor_from_functor{*this, n}; + return seqan::stl::detail::adaptor_from_functor{*this, n}; } - template > - constexpr auto operator()(Range && range, ::std::type_identity_t n) const + template > + constexpr auto operator()(Range && range, std::type_identity_t n) const { - return chunk_view{::std::forward(range), n}; + return chunk_view{std::forward(range), n}; } }; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::views +namespace seqan::stl::views { -inline constexpr auto chunk = seqan::std::ranges::chunk_fn{}; +inline constexpr auto chunk = seqan::stl::ranges::chunk_fn{}; -} // namespace seqan::std::views +} // namespace seqan::stl::views #endif // ifdef __cpp_lib_ranges_chunk diff --git a/concepts.hpp b/concepts.hpp index c2456221..9be1a376 100644 --- a/concepts.hpp +++ b/concepts.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std concepts. + * \brief Provides seqan::stl concepts. */ // File might be included from multiple libraries. @@ -17,27 +17,27 @@ #include #if __cpp_lib_ranges >= 202110L -namespace seqan::std::ranges +namespace seqan::stl::ranges { -using ::std::ranges::viewable_range; +using std::ranges::viewable_range; } #else # include "detail/exposition_only.hpp" -namespace seqan::std::ranges +namespace seqan::stl::ranges { template -concept viewable_range = ::std::ranges::range - && ((::std::ranges::view<::std::remove_cvref_t> - && ::std::constructible_from<::std::remove_cvref_t, T>) - || (!::std::ranges::view<::std::remove_cvref_t> - && (::std::is_lvalue_reference_v - || (::std::movable<::std::remove_reference_t> - && !seqan::std::detail::is_initializer_list<::std::remove_cvref_t>)))); - -} // namespace seqan::std::ranges +concept viewable_range = std::ranges::range + && ((std::ranges::view> + && std::constructible_from, T>) + || (!std::ranges::view> + && (std::is_lvalue_reference_v + || (std::movable> + && !seqan::stl::detail::is_initializer_list>)))); + +} // namespace seqan::stl::ranges #endif diff --git a/detail/adaptor_base.hpp b/detail/adaptor_base.hpp index b80f6f59..2ab85f9b 100644 --- a/detail/adaptor_base.hpp +++ b/detail/adaptor_base.hpp @@ -6,7 +6,7 @@ // ----------------------------------------------------------------------------------------------------- /*!\file - * \brief Provides seqan::std::detail::adaptor_base and seqan::std::detail::combined_adaptor + * \brief Provides seqan::stl::detail::adaptor_base and seqan::stl::detail::combined_adaptor * \author Hannes Hauswedell */ @@ -17,7 +17,7 @@ #include #include -namespace seqan::std::detail +namespace seqan::stl::detail { // ============================================================================ @@ -37,27 +37,27 @@ class adaptor_base { private: //!\brief Stores the arguments. - ::std::tuple arguments; + std::tuple arguments; //!\brief Helper function to unpack the tuple and delegate to the derived type. template - constexpr auto pass_args_to_impl(urng_t && urange, ::std::index_sequence const &) const & + constexpr auto pass_args_to_impl(urng_t && urange, std::index_sequence const &) const & { - // ::std::get returns lvalue-reference to value, but we need to copy the values + // std::get returns lvalue-reference to value, but we need to copy the values // so that the view does not depend on the functor return static_cast(*this).impl( - ::std::forward(urange), - ::std::tuple_element_t>(::std::get(arguments))...); + std::forward(urange), + std::tuple_element_t>(std::get(arguments))...); } //!\overload template - constexpr auto pass_args_to_impl(urng_t && urange, ::std::index_sequence const &) && + constexpr auto pass_args_to_impl(urng_t && urange, std::index_sequence const &) && { // move out values, because we don't need them anymore (*this is temporary) return static_cast(*this).impl( - ::std::forward(urange), - ::std::tuple_element_t>(::std::get(::std::move(arguments)))...); + std::forward(urange), + std::tuple_element_t>(std::get(std::move(arguments)))...); } //!\brief Befriend the derived_type so it can access private members if need be. @@ -75,26 +75,25 @@ class adaptor_base ~adaptor_base() noexcept = default; //!< Defaulted. //!\brief Constructor with possible arguments; becomes a default constructor for adaptors without args. - constexpr adaptor_base(stored_args_ts... args) noexcept(noexcept(::std::tuple{ - ::std::forward(args)...})) : - arguments{::std::forward(args)...} + constexpr adaptor_base(stored_args_ts... args) noexcept(noexcept(std::tuple{ + std::forward(args)...})) : + arguments{std::forward(args)...} {} //!\} //!\brief Function-style overload for ranges. - template <::std::ranges::input_range urng_t> + template constexpr auto operator()(urng_t && urange) const & { - return pass_args_to_impl(::std::forward(urange), - ::std::make_index_sequence{}); + return pass_args_to_impl(std::forward(urange), std::make_index_sequence{}); } //!\overload - template <::std::ranges::input_range urng_t> + template constexpr auto operator()(urng_t && urange) && { - return ::std::move(*this).pass_args_to_impl(::std::forward(urange), - ::std::make_index_sequence{}); + return std::move(*this).pass_args_to_impl(std::forward(urange), + std::make_index_sequence{}); } /*!\brief Left-hand-side pipe operator that handles range input or composing. @@ -104,27 +103,27 @@ class adaptor_base * * \details * - * If the LHS models ::std::ranges::input_range this functions delegates to operator() + * If the LHS models std::ranges::input_range this functions delegates to operator() * otherwise it assumes the LHS is another range adaptor closure object and it * returns a seqan3::detail::combined_adaptor that wraps that adaptor and this one. */ template constexpr friend auto operator|(arg_t && arg, derived_type const & me) { - if constexpr (::std::ranges::input_range) - return me(::std::forward(arg)); + if constexpr (std::ranges::input_range) + return me(std::forward(arg)); else - return combined_adaptor{::std::forward(arg), me}; + return combined_adaptor{std::forward(arg), me}; } //!\overload template constexpr friend auto operator|(arg_t && arg, derived_type && me) { - if constexpr (::std::ranges::input_range) - return ::std::move(me)(::std::forward(arg)); + if constexpr (std::ranges::input_range) + return std::move(me)(std::forward(arg)); else - return combined_adaptor{::std::forward(arg), ::std::move(me)}; + return combined_adaptor{std::forward(arg), std::move(me)}; } /*!\brief Right-hand-side pipe operator that handles composing. @@ -146,14 +145,14 @@ class adaptor_base template constexpr friend auto operator|(adaptor_base const & me, arg_t && arg) { - return combined_adaptor{static_cast(me), ::std::forward(arg)}; + return combined_adaptor{static_cast(me), std::forward(arg)}; } //!\overload template constexpr friend auto operator|(adaptor_base && me, arg_t && arg) { - return combined_adaptor{static_cast(me), ::std::forward(arg)}; + return combined_adaptor{static_cast(me), std::forward(arg)}; } }; @@ -182,11 +181,11 @@ class combined_adaptor : friend base_type; //!\brief Combine all arguments via `operator|`. - template <::std::ranges::input_range urng_t, typename left_adaptor_t_, typename right_adaptor_t_> + template static auto impl(urng_t && urange, left_adaptor_t_ && left_adaptor, right_adaptor_t_ && right_adaptor) { - return ::std::forward(urange) | ::std::forward(left_adaptor) - | ::std::forward(right_adaptor); + return std::forward(urange) | std::forward(left_adaptor) + | std::forward(right_adaptor); } public: @@ -205,11 +204,11 @@ class combined_adaptor : //!\brief Store both arguments in the adaptor. constexpr combined_adaptor(left_adaptor_t l, right_adaptor_t r) : - base_type{::std::forward(l), ::std::forward(r)} + base_type{std::forward(l), std::forward(r)} {} //!\} }; -} // namespace seqan::std::detail +} // namespace seqan::stl::detail #endif // SEQAN_STD_DETAIL_ADAPTOR_BASE diff --git a/detail/adaptor_for_view_without_args.hpp b/detail/adaptor_for_view_without_args.hpp index 61ee565e..ae3208ca 100644 --- a/detail/adaptor_for_view_without_args.hpp +++ b/detail/adaptor_for_view_without_args.hpp @@ -6,7 +6,7 @@ // ----------------------------------------------------------------------------------------------------- /*!\file - * \brief Provides seqan::std::detail::adaptor_for_view_without_args + * \brief Provides seqan::stl::detail::adaptor_for_view_without_args * \author Hannes Hauswedell */ @@ -16,7 +16,7 @@ #include "adaptor_base.hpp" -namespace seqan::std::detail +namespace seqan::stl::detail { // ============================================================================ @@ -43,7 +43,7 @@ class adaptor_for_view_without_args : public adaptor_base static auto impl(arg_types &&... args) { - return view_type{::std::forward(args)...}; + return view_type{std::forward(args)...}; } public: @@ -68,6 +68,6 @@ class adaptor_for_view_without_args : public adaptor_base */ @@ -16,7 +16,7 @@ #include "adaptor_base.hpp" -namespace seqan::std::detail +namespace seqan::stl::detail { // ============================================================================ @@ -45,10 +45,10 @@ class adaptor_from_functor : * \param[in] args The arguments to the constructor. * \returns Whatever the wrapped functor returns, usually a view. */ - template <::std::ranges::input_range urng_t> + template constexpr auto impl(urng_t && urange, stored_args_ts... args) const { - return fun(::std::forward(urange), ::std::forward(args)...); + return fun(std::forward(urange), std::forward(args)...); } public: @@ -64,12 +64,12 @@ class adaptor_from_functor : //!\brief Construct from functor and possibly arguments. constexpr adaptor_from_functor(functor_type f, stored_args_ts... args) : - base_type{::std::forward(args)...}, - fun{::std::move(f)} + base_type{std::forward(args)...}, + fun{std::move(f)} {} //!\} }; -} // namespace seqan::std::detail +} // namespace seqan::stl::detail #endif // SEQAN_STD_DETAIL_ADAPTOR_FROM_FUNCTOR diff --git a/detail/compiler_definitions.hpp b/detail/compiler_definitions.hpp index 39aa7877..417205b8 100644 --- a/detail/compiler_definitions.hpp +++ b/detail/compiler_definitions.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides compiler definitions for seqan::std. + * \brief Provides compiler definitions for seqan::stl. */ // File might be included from multiple libraries. diff --git a/detail/exposition_only.hpp b/detail/exposition_only.hpp index 1ff1584a..b14e18be 100644 --- a/detail/exposition_only.hpp +++ b/detail/exposition_only.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::detail implementation helper that are used in multiple files. + * \brief Provides seqan::stl::detail implementation helper that are used in multiple files. */ // File might be included from multiple libraries. @@ -16,23 +16,23 @@ #include -namespace seqan::std::detail +namespace seqan::stl::detail { template inline constexpr bool is_initializer_list = false; template -inline constexpr bool is_initializer_list<::std::initializer_list> = true; +inline constexpr bool is_initializer_list> = true; template -concept simple_view = ::std::ranges::view && ::std::ranges::range - && ::std::same_as<::std::ranges::iterator_t, ::std::ranges::iterator_t> - && ::std::same_as<::std::ranges::sentinel_t, ::std::ranges::sentinel_t>; +concept simple_view = std::ranges::view && std::ranges::range + && std::same_as, std::ranges::iterator_t> + && std::same_as, std::ranges::sentinel_t>; template -using maybe_const = ::std::conditional_t; +using maybe_const = std::conditional_t; -} // namespace seqan::std::detail +} // namespace seqan::stl::detail #endif // SEQAN_STD_DETAIL_EXPOSITION_ONLY diff --git a/detail/non_propagating_cache.hpp b/detail/non_propagating_cache.hpp index 424dac38..3059a4ec 100644 --- a/detail/non_propagating_cache.hpp +++ b/detail/non_propagating_cache.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides [seqan::std::detail::non_propagating_cache](https://eel.is/c++draft/range.nonprop.cache). + * \brief Provides [seqan::stl::detail::non_propagating_cache](https://eel.is/c++draft/range.nonprop.cache). */ // File might be included from multiple libraries. @@ -16,14 +16,14 @@ #include -namespace seqan::std::detail +namespace seqan::stl::detail { /*!\brief A helper that enables an input view to temporarily cache values as it is iterated over. * \sa https://eel.is/c++draft/range.nonprop.cache * \details * - * Behaves like ::std::optional, but + * Behaves like std::optional, but * - Constrains its type parameter `T` with `std::is_object_v`. * - Copy constructor is a no-op. * - Move constructor is a no-op for `this` and destroys value of `other`. @@ -32,14 +32,14 @@ namespace seqan::std::detail * - Has an additional `emplace_deref` member function. */ template - requires ::std::is_object_v -class non_propagating_cache : public ::std::optional + requires std::is_object_v +class non_propagating_cache : public std::optional { public: - //!\brief Use ::std::optional constructors. - using ::std::optional::optional; - //!\brief Use ::std::optional assignment operators. - using ::std::optional::operator=; + //!\brief Use std::optional constructors. + using std::optional::optional; + //!\brief Use std::optional assignment operators. + using std::optional::operator=; //!\brief Copy construction is a no-op. constexpr non_propagating_cache(non_propagating_cache const &) noexcept @@ -54,7 +54,7 @@ class non_propagating_cache : public ::std::optional //!\brief Copy assignment is a no-op if `this` == `other`, otherwise destroys value of `this`. constexpr non_propagating_cache & operator=(non_propagating_cache const & other) noexcept { - if (::std::addressof(other) != this) + if (std::addressof(other) != this) this->reset(); return *this; } @@ -78,6 +78,6 @@ class non_propagating_cache : public ::std::optional } }; -} // namespace seqan::std::detail +} // namespace seqan::stl::detail #endif // SEQAN_STD_DETAIL_NON_PROPAGATING_CACHE diff --git a/join_with_view.hpp b/join_with_view.hpp index 25825cdd..0b09c9f1 100644 --- a/join_with_view.hpp +++ b/join_with_view.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::views::join_with. + * \brief Provides seqan::stl::views::join_with. */ // File might be included from multiple libraries. @@ -18,12 +18,12 @@ #ifdef __cpp_lib_ranges_join_with -namespace seqan::std::views +namespace seqan::stl::views { -using ::std::ranges::views::join_with; +using std::ranges::views::join_with; -} // namespace seqan::std::views +} // namespace seqan::stl::views #else @@ -36,18 +36,17 @@ using ::std::ranges::views::join_with; # include "detail/exposition_only.hpp" # include "detail/non_propagating_cache.hpp" -namespace seqan::std::detail::join_with +namespace seqan::stl::detail::join_with { template concept compatible_joinable_ranges = - ::std::common_with<::std::ranges::range_value_t, ::std::ranges::range_value_t

> - && ::std::common_reference_with<::std::ranges::range_reference_t, ::std::ranges::range_reference_t

> - && ::std::common_reference_with<::std::ranges::range_rvalue_reference_t, - ::std::ranges::range_rvalue_reference_t

>; + std::common_with, std::ranges::range_value_t

> + && std::common_reference_with, std::ranges::range_reference_t

> + && std::common_reference_with, std::ranges::range_rvalue_reference_t

>; template -concept bidirectional_common = ::std::ranges::bidirectional_range && ::std::ranges::common_range; +concept bidirectional_common = std::ranges::bidirectional_range && std::ranges::common_range; // A helper to decide whether the join_with view should have a non_propagating_cache member. template @@ -56,33 +55,33 @@ struct cache_helper // If the inner range is a reference, we do not need a cache. template - requires ::std::is_reference_v + requires std::is_reference_v struct cache_helper {}; // If the inner range is not a reference, we need a cache. template - requires (!::std::is_reference_v) + requires (!std::is_reference_v) struct cache_helper { - non_propagating_cache<::std::remove_cv_t> inner_; + non_propagating_cache> inner_; }; -} // namespace seqan::std::detail::join_with +} // namespace seqan::stl::detail::join_with -namespace seqan::std::ranges +namespace seqan::stl::ranges { -template <::std::ranges::input_range V, ::std::ranges::forward_range Pattern> - requires ::std::ranges::view && ::std::ranges::input_range<::std::ranges::range_reference_t> - && ::std::ranges::view - && seqan::std::detail::join_with::compatible_joinable_ranges<::std::ranges::range_reference_t, Pattern> +template + requires std::ranges::view && std::ranges::input_range> + && std::ranges::view + && seqan::stl::detail::join_with::compatible_joinable_ranges, Pattern> class join_with_view : - public ::std::ranges::view_interface>, - private seqan::std::detail::join_with::cache_helper<::std::ranges::range_reference_t> + public std::ranges::view_interface>, + private seqan::stl::detail::join_with::cache_helper> { private: - using InnerRng = ::std::ranges::range_reference_t; + using InnerRng = std::ranges::range_reference_t; V base_{}; @@ -96,106 +95,105 @@ class join_with_view : public: join_with_view() - requires ::std::default_initializable && ::std::default_initializable + requires std::default_initializable && std::default_initializable = default; - constexpr join_with_view(V base, Pattern pattern) : base_(::std::move(base)), pattern_(::std::move(pattern)) + constexpr join_with_view(V base, Pattern pattern) : base_(std::move(base)), pattern_(std::move(pattern)) {} - template <::std::ranges::input_range R> - requires ::std::constructible_from> - && ::std::constructible_from>> - constexpr join_with_view(R && r, ::std::ranges::range_value_t e) : - base_(::std::ranges::views::all(::std::forward(r))), - pattern_(::std::ranges::views::single(::std::move(e))) + template + requires std::constructible_from> + && std::constructible_from>> + constexpr join_with_view(R && r, std::ranges::range_value_t e) : + base_(std::ranges::views::all(std::forward(r))), + pattern_(std::ranges::views::single(std::move(e))) {} constexpr V base() const & - requires ::std::copy_constructible + requires std::copy_constructible { return base_; } constexpr V base() && { - return ::std::move(base_); + return std::move(base_); } constexpr auto begin() { // In essence, simple_view means that the iterators of the non-const view and const range are the same and // the sentinels of the non-const view and const range are the same. - // If ::std::is_reference_v, we do not have a cache to store the value. Hence, we do not change + // If std::is_reference_v, we do not have a cache to store the value. Hence, we do not change // any members and can use the const iterator. - constexpr bool use_const = seqan::std::detail::simple_view && ::std::is_reference_v - && seqan::std::detail::simple_view; - return iterator{*this, ::std::ranges::begin(base_)}; + constexpr bool use_const = seqan::stl::detail::simple_view && std::is_reference_v + && seqan::stl::detail::simple_view; + return iterator{*this, std::ranges::begin(base_)}; } constexpr auto begin() const - requires ::std::ranges::input_range && ::std::ranges::forward_range - && ::std::is_reference_v<::std::ranges::range_reference_t> + requires std::ranges::input_range && std::ranges::forward_range + && std::is_reference_v> { - return iterator{*this, ::std::ranges::begin(base_)}; + return iterator{*this, std::ranges::begin(base_)}; } constexpr auto end() { - constexpr bool is_simple = seqan::std::detail::simple_view && seqan::std::detail::simple_view; - if constexpr (::std::ranges::forward_range && ::std::is_reference_v - && ::std::ranges::forward_range && ::std::ranges::common_range - && ::std::ranges::common_range) - return iterator{*this, ::std::ranges::end(base_)}; + constexpr bool is_simple = seqan::stl::detail::simple_view && seqan::stl::detail::simple_view; + if constexpr (std::ranges::forward_range && std::is_reference_v + && std::ranges::forward_range && std::ranges::common_range + && std::ranges::common_range) + return iterator{*this, std::ranges::end(base_)}; else return sentinel{*this}; } constexpr auto end() const - requires ::std::ranges::input_range && ::std::ranges::forward_range - && ::std::is_reference_v<::std::ranges::range_reference_t> + requires std::ranges::input_range && std::ranges::forward_range + && std::is_reference_v> { - using InnerConstRng = ::std::ranges::range_reference_t; - if constexpr (::std::ranges::forward_range && ::std::ranges::forward_range - && ::std::ranges::common_range && ::std::ranges::common_range) - return iterator{*this, ::std::ranges::end(base_)}; + using InnerConstRng = std::ranges::range_reference_t; + if constexpr (std::ranges::forward_range && std::ranges::forward_range + && std::ranges::common_range && std::ranges::common_range) + return iterator{*this, std::ranges::end(base_)}; else return sentinel{*this}; } }; template -join_with_view(R &&, P &&) -> join_with_view, seqan::std::views::all_t

>; +join_with_view(R &&, P &&) -> join_with_view, seqan::stl::views::all_t

>; -template <::std::ranges::input_range R> -join_with_view(R &&, ::std::ranges::range_value_t<::std::ranges::range_reference_t>) - -> join_with_view, - ::std::ranges::single_view<::std::ranges::range_value_t<::std::ranges::range_reference_t>>>; +template +join_with_view(R &&, std::ranges::range_value_t>) + -> join_with_view, + std::ranges::single_view>>>; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::detail::join_with +namespace seqan::stl::detail::join_with { template struct helper { - using Parent = seqan::std::detail::maybe_const>; - using Base = seqan::std::detail::maybe_const; - using InnerBase = ::std::ranges::range_reference_t; - using PatternBase = seqan::std::detail::maybe_const; + using Parent = seqan::stl::detail::maybe_const>; + using Base = seqan::stl::detail::maybe_const; + using InnerBase = std::ranges::range_reference_t; + using PatternBase = seqan::stl::detail::maybe_const; - using OuterIter = ::std::ranges::iterator_t; - using InnerIter = ::std::ranges::iterator_t; - using PatternIter = ::std::ranges::iterator_t; + using OuterIter = std::ranges::iterator_t; + using InnerIter = std::ranges::iterator_t; + using PatternIter = std::ranges::iterator_t; - static constexpr bool ref_is_glvalue = ::std::is_reference_v; + static constexpr bool ref_is_glvalue = std::is_reference_v; }; template struct iterator_category_t; -// If ::std::is_reference_v is true, define iterator_category. +// If std::is_reference_v is true, define iterator_category. template struct iterator_category_t { @@ -208,51 +206,50 @@ struct iterator_category_t using InnerIter = helper::InnerIter; using PatternIter = helper::PatternIter; - using iterator_category = ::std::conditional_t< - !::std::is_lvalue_reference_v< - ::std::common_reference_t<::std::iter_reference_t, ::std::iter_reference_t>>, - ::std::input_iterator_tag, - ::std::conditional_t< - ::std::derived_from<::std::bidirectional_iterator_tag, - typename ::std::iterator_traits::iterator_category> && ::std:: - derived_from<::std::bidirectional_iterator_tag, - typename ::std::iterator_traits::iterator_category> && ::std:: - derived_from<::std::bidirectional_iterator_tag, - typename ::std::iterator_traits::iterator_category> && ::std::ranges:: - common_range && ::std::ranges::common_range, - ::std::bidirectional_iterator_tag, - ::std::conditional_t< - ::std::derived_from<::std::forward_iterator_tag, - typename ::std::iterator_traits::iterator_category> && ::std:: - derived_from<::std::forward_iterator_tag, - typename ::std::iterator_traits::iterator_category> && ::std:: - derived_from<::std::forward_iterator_tag, - typename ::std::iterator_traits::iterator_category>, - ::std::forward_iterator_tag, - ::std::input_iterator_tag>>>; + using iterator_category = std::conditional_t< + !std::is_lvalue_reference_v< + std::common_reference_t, std::iter_reference_t>>, + std::input_iterator_tag, + std::conditional_t< + std::derived_from::iterator_category> + && std::derived_from::iterator_category> + && std::derived_from::iterator_category> + && std::ranges::common_range && std::ranges::common_range, + std::bidirectional_iterator_tag, + std::conditional_t::iterator_category> + && std::derived_from::iterator_category> + && std::derived_from::iterator_category>, + std::forward_iterator_tag, + std::input_iterator_tag>>>; }; -// If ::std::is_reference_v is false, there is no iterator_category. +// If std::is_reference_v is false, there is no iterator_category. template struct iterator_category_t {}; -} // namespace seqan::std::detail::join_with +} // namespace seqan::stl::detail::join_with -namespace seqan::std::ranges +namespace seqan::stl::ranges { -template <::std::ranges::input_range V, ::std::ranges::forward_range Pattern> - requires ::std::ranges::view && ::std::ranges::input_range<::std::ranges::range_reference_t> - && ::std::ranges::view - && seqan::std::detail::join_with::compatible_joinable_ranges<::std::ranges::range_reference_t, Pattern> +template + requires std::ranges::view && std::ranges::input_range> + && std::ranges::view + && seqan::stl::detail::join_with::compatible_joinable_ranges, Pattern> template class join_with_view::iterator : - public seqan::std::detail::join_with:: - iterator_category_t::ref_is_glvalue> + public seqan::stl::detail::join_with:: + iterator_category_t::ref_is_glvalue> { private: - using helper_t = seqan::std::detail::join_with::helper; + using helper_t = seqan::stl::detail::join_with::helper; using Parent = helper_t::Parent; using Base = helper_t::Base; using InnerBase = helper_t::InnerBase; @@ -274,16 +271,16 @@ SEQAN_STD_NESTED_VISIBILITY OuterIter outer_it_{}; private: - ::std::variant inner_it_{}; + std::variant inner_it_{}; - constexpr iterator(Parent & parent, ::std::ranges::iterator_t outer) : - parent_(::std::addressof(parent)), - outer_it_(::std::move(outer)) + constexpr iterator(Parent & parent, std::ranges::iterator_t outer) : + parent_(std::addressof(parent)), + outer_it_(std::move(outer)) { - if (outer_it_ != ::std::ranges::end(parent_->base_)) + if (outer_it_ != std::ranges::end(parent_->base_)) { auto && inner = update_inner(outer_it_); - inner_it_.template emplace<1>(::std::ranges::begin(inner)); + inner_it_.template emplace<1>(std::ranges::begin(inner)); satisfy(); } } @@ -312,65 +309,64 @@ SEQAN_STD_NESTED_VISIBILITY { if (inner_it_.index() == 0) { - if (::std::get<0>(inner_it_) != ::std::ranges::end(parent_->pattern_)) + if (std::get<0>(inner_it_) != std::ranges::end(parent_->pattern_)) break; auto && inner = update_inner(outer_it_); - inner_it_.template emplace<1>(::std::ranges::begin(inner)); + inner_it_.template emplace<1>(std::ranges::begin(inner)); } else { auto && inner = get_inner(outer_it_); - if (::std::get<1>(inner_it_) != ::std::ranges::end(inner)) + if (std::get<1>(inner_it_) != std::ranges::end(inner)) break; - if (++outer_it_ == ::std::ranges::end(parent_->base_)) + if (++outer_it_ == std::ranges::end(parent_->base_)) { if constexpr (ref_is_glvalue) inner_it_.template emplace<0>(); break; } - inner_it_.template emplace<0>(::std::ranges::begin(parent_->pattern_)); + inner_it_.template emplace<0>(std::ranges::begin(parent_->pattern_)); } } } public: - using iterator_concept = ::std::conditional_t< + using iterator_concept = std::conditional_t< !ref_is_glvalue, - ::std::input_iterator_tag, - ::std::conditional_t< - ::std::ranges::bidirectional_range && seqan::std::detail::join_with::bidirectional_common - && seqan::std::detail::join_with::bidirectional_common, - ::std::bidirectional_iterator_tag, - ::std::conditional_t<::std::ranges::forward_range && ::std::ranges::forward_range, - ::std::forward_iterator_tag, - ::std::input_iterator_tag>>>; - - using value_type = ::std::common_type_t<::std::iter_value_t, ::std::iter_value_t>; - using difference_type = ::std::common_type_t<::std::iter_difference_t, - ::std::iter_difference_t, - ::std::iter_difference_t>; + std::input_iterator_tag, + std::conditional_t + && seqan::stl::detail::join_with::bidirectional_common + && seqan::stl::detail::join_with::bidirectional_common, + std::bidirectional_iterator_tag, + std::conditional_t && std::ranges::forward_range, + std::forward_iterator_tag, + std::input_iterator_tag>>>; + + using value_type = std::common_type_t, std::iter_value_t>; + using difference_type = std::common_type_t, + std::iter_difference_t, + std::iter_difference_t>; iterator() - requires ::std::default_initializable + requires std::default_initializable = default; constexpr iterator(iterator i) - requires Const && ::std::convertible_to<::std::ranges::iterator_t, OuterIter> - && ::std::convertible_to<::std::ranges::iterator_t, InnerIter> - && ::std::convertible_to<::std::ranges::iterator_t, PatternIter> - : outer_it_(::std::move(i.outer_it_)), parent_(i.parent_) + requires Const && std::convertible_to, OuterIter> + && std::convertible_to, InnerIter> + && std::convertible_to, PatternIter> + : outer_it_(std::move(i.outer_it_)), parent_(i.parent_) { if (i.inner_it_.index() == 0) - inner_it_.template emplace<0>(::std::get<0>(::std::move(i.inner_it_))); + inner_it_.template emplace<0>(std::get<0>(std::move(i.inner_it_))); else - inner_it_.template emplace<1>(::std::get<1>(::std::move(i.inner_it_))); + inner_it_.template emplace<1>(std::get<1>(std::move(i.inner_it_))); } constexpr decltype(auto) operator*() const { - using reference = - ::std::common_reference_t<::std::iter_reference_t, ::std::iter_reference_t>; - return ::std::visit( + using reference = std::common_reference_t, std::iter_reference_t>; + return std::visit( [](auto & it) -> reference { return *it; @@ -380,7 +376,7 @@ SEQAN_STD_NESTED_VISIBILITY constexpr iterator & operator++() { - ::std::visit( + std::visit( [](auto & it) { ++it; @@ -396,7 +392,7 @@ SEQAN_STD_NESTED_VISIBILITY } constexpr iterator operator++(int) - requires ref_is_glvalue && ::std::forward_iterator && ::std::forward_iterator + requires ref_is_glvalue && std::forward_iterator && std::forward_iterator { iterator tmp = *this; ++*this; @@ -404,14 +400,14 @@ SEQAN_STD_NESTED_VISIBILITY } constexpr iterator & operator--() - requires ref_is_glvalue && ::std::ranges::bidirectional_range - && seqan::std::detail::join_with::bidirectional_common - && seqan::std::detail::join_with::bidirectional_common + requires ref_is_glvalue && std::ranges::bidirectional_range + && seqan::stl::detail::join_with::bidirectional_common + && seqan::stl::detail::join_with::bidirectional_common { - if (outer_it_ == ::std::ranges::end(parent_->base_)) + if (outer_it_ == std::ranges::end(parent_->base_)) { auto && inner = *--outer_it_; - inner_it_.template emplace<1>(::std::ranges::end(inner)); + inner_it_.template emplace<1>(std::ranges::end(inner)); } // Similar to satifsy(). Skips over empty inner ranges when going backwards. @@ -419,11 +415,11 @@ SEQAN_STD_NESTED_VISIBILITY { if (inner_it_.index() == 0) { - auto & it = ::std::get<0>(inner_it_); - if (it == ::std::ranges::begin(parent_->pattern_)) + auto & it = std::get<0>(inner_it_); + if (it == std::ranges::begin(parent_->pattern_)) { auto && inner = *--outer_it_; - inner_it_.template emplace<1>(::std::ranges::end(inner)); + inner_it_.template emplace<1>(std::ranges::end(inner)); } else { @@ -432,11 +428,11 @@ SEQAN_STD_NESTED_VISIBILITY } else { - auto & it = ::std::get<1>(inner_it_); + auto & it = std::get<1>(inner_it_); auto && inner = *outer_it_; - if (it == ::std::ranges::begin(inner)) + if (it == std::ranges::begin(inner)) { - inner_it_.template emplace<0>(::std::ranges::end(parent_->pattern_)); + inner_it_.template emplace<0>(std::ranges::end(parent_->pattern_)); } else { @@ -445,7 +441,7 @@ SEQAN_STD_NESTED_VISIBILITY } } - ::std::visit( + std::visit( [](auto & it) { --it; @@ -455,9 +451,9 @@ SEQAN_STD_NESTED_VISIBILITY } constexpr iterator operator--(int) - requires ref_is_glvalue && ::std::ranges::bidirectional_range - && seqan::std::detail::join_with::bidirectional_common - && seqan::std::detail::join_with::bidirectional_common + requires ref_is_glvalue && std::ranges::bidirectional_range + && seqan::stl::detail::join_with::bidirectional_common + && seqan::stl::detail::join_with::bidirectional_common { iterator tmp = *this; --*this; @@ -465,52 +461,52 @@ SEQAN_STD_NESTED_VISIBILITY } friend constexpr bool operator==(iterator const & x, iterator const & y) - requires ref_is_glvalue && ::std::equality_comparable && ::std::equality_comparable + requires ref_is_glvalue && std::equality_comparable && std::equality_comparable { return x.outer_it_ == y.outer_it_ && x.inner_it_ == y.inner_it_; } friend constexpr decltype(auto) iter_move(iterator const & x) { - using rvalue_reference = ::std::common_reference_t<::std::iter_rvalue_reference_t, - ::std::iter_rvalue_reference_t>; - return ::std::visit(::std::ranges::iter_move, x.inner_it_); + using rvalue_reference = + std::common_reference_t, std::iter_rvalue_reference_t>; + return std::visit(std::ranges::iter_move, x.inner_it_); } friend constexpr void iter_swap(iterator const & x, iterator const & y) - requires ::std::indirectly_swappable + requires std::indirectly_swappable { - ::std::visit(::std::ranges::iter_swap, x.inner_it_, y.inner_it_); + std::visit(std::ranges::iter_swap, x.inner_it_, y.inner_it_); } }; -template <::std::ranges::input_range V, ::std::ranges::forward_range Pattern> - requires ::std::ranges::view && ::std::ranges::input_range<::std::ranges::range_reference_t> - && ::std::ranges::view - && seqan::std::detail::join_with::compatible_joinable_ranges<::std::ranges::range_reference_t, Pattern> +template + requires std::ranges::view && std::ranges::input_range> + && std::ranges::view + && seqan::stl::detail::join_with::compatible_joinable_ranges, Pattern> template class join_with_view::sentinel { private: - using Parent = seqan::std::detail::maybe_const; - using Base = seqan::std::detail::maybe_const; - ::std::ranges::sentinel_t end_ = ::std::ranges::sentinel_t(); + using Parent = seqan::stl::detail::maybe_const; + using Base = seqan::stl::detail::maybe_const; + std::ranges::sentinel_t end_ = std::ranges::sentinel_t(); friend class join_with_view; - constexpr explicit sentinel(Parent & parent) : end_(::std::ranges::end(parent.base_)) + constexpr explicit sentinel(Parent & parent) : end_(std::ranges::end(parent.base_)) {} public: sentinel() = default; constexpr sentinel(sentinel s) - requires Const && ::std::convertible_to<::std::ranges::sentinel_t, ::std::ranges::sentinel_t> - : end_(::std::move(s.end_)) + requires Const && std::convertible_to, std::ranges::sentinel_t> + : end_(std::move(s.end_)) {} template - requires ::std::sentinel_for<::std::ranges::sentinel_t, - ::std::ranges::iterator_t>> + requires std::sentinel_for, + std::ranges::iterator_t>> friend constexpr bool operator==(iterator const & x, sentinel const & y) { return x.outer_it_ == y.end_; @@ -522,24 +518,24 @@ struct join_with_fn template constexpr auto operator()(Pattern && pattern) const { - return seqan::std::detail::adaptor_from_functor{*this, ::std::forward(pattern)}; + return seqan::stl::detail::adaptor_from_functor{*this, std::forward(pattern)}; } - template + template constexpr auto operator()(urng_t && urange, Pattern && pattern) const { - return join_with_view{::std::forward(urange), ::std::forward(pattern)}; + return join_with_view{std::forward(urange), std::forward(pattern)}; } }; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges -namespace seqan::std::views +namespace seqan::stl::views { -inline constexpr auto join_with = seqan::std::ranges::join_with_fn{}; +inline constexpr auto join_with = seqan::stl::ranges::join_with_fn{}; -} // namespace seqan::std::views +} // namespace seqan::stl::views #endif // ifdef __cpp_lib_ranges_join_with diff --git a/pair.hpp b/pair.hpp index e6d66f13..f3e8f65f 100644 --- a/pair.hpp +++ b/pair.hpp @@ -6,7 +6,7 @@ // ----------------------------------------------------------------------------------------------------- /*!\file - * \brief Provides seqan::std::pair. + * \brief Provides seqan::stl::pair. * \author Enrico Seiler */ @@ -17,24 +17,24 @@ #ifdef __cpp_lib_tuple_like -namespace seqan::std +namespace seqan::stl { -using ::std::pair; +using std::pair; -} // namespace seqan::std +} // namespace seqan::stl #else -namespace seqan::std +namespace seqan::stl { template -struct pair : public ::std::pair +struct pair : public std::pair { private: - //!\brief The underlying ::std::pair type. - using base_t = ::std::pair; + //!\brief The underlying std::pair type. + using base_t = std::pair; public: /*!\name Default constructors and assignments. @@ -54,24 +54,24 @@ struct pair : public ::std::pair */ //!@{ Constructs from arguments. template - requires (::std::is_constructible_v && ::std::is_constructible_v) + requires (std::is_constructible_v && std::is_constructible_v) constexpr pair(U1 & first, U2 & second) : base_t(first, second) {} template - requires (::std::is_constructible_v && ::std::is_constructible_v) + requires (std::is_constructible_v && std::is_constructible_v) constexpr pair(U1 const & first, U2 const & second) : base_t(first, second) {} template - requires (::std::is_constructible_v && ::std::is_constructible_v) - constexpr pair(U1 && first, U2 && second) : base_t(::std::forward(first), ::std::forward(second)) + requires (std::is_constructible_v && std::is_constructible_v) + constexpr pair(U1 && first, U2 && second) : base_t(std::forward(first), std::forward(second)) {} template - requires (::std::is_constructible_v && ::std::is_constructible_v) + requires (std::is_constructible_v && std::is_constructible_v) constexpr pair(U1 const && first, U2 const && second) : - base_t(::std::forward(first), ::std::forward(second)) + base_t(std::forward(first), std::forward(second)) {} //!@} //!\} @@ -81,52 +81,51 @@ struct pair : public ::std::pair */ //!@{ Constructs from pair. template - requires (::std::is_constructible_v && ::std::is_constructible_v) + requires (std::is_constructible_v && std::is_constructible_v) constexpr pair(pair & other) : base_t(other.first, other.second) {} template - requires (::std::is_constructible_v && ::std::is_constructible_v) + requires (std::is_constructible_v && std::is_constructible_v) constexpr pair(pair const & other) : base_t(other.first, other.second) {} template - requires (::std::is_constructible_v && ::std::is_constructible_v) - constexpr pair(pair && other) : base_t(::std::forward(other.first), ::std::forward(other.second)) + requires (std::is_constructible_v && std::is_constructible_v) + constexpr pair(pair && other) : base_t(std::forward(other.first), std::forward(other.second)) {} template - requires (::std::is_constructible_v && ::std::is_constructible_v) + requires (std::is_constructible_v && std::is_constructible_v) constexpr pair(pair const && other) : - base_t(::std::forward(other.first), ::std::forward(other.second)) + base_t(std::forward(other.first), std::forward(other.second)) {} //!@} //!\} - /*!\name Construct from ::std::pair. + /*!\name Construct from std::pair. * \{ */ - //!@{ Constructs from ::std::pair. + //!@{ Constructs from std::pair. template - requires (::std::is_constructible_v && ::std::is_constructible_v) - constexpr pair(::std::pair & other) : base_t(other.first, other.second) + requires (std::is_constructible_v && std::is_constructible_v) + constexpr pair(std::pair & other) : base_t(other.first, other.second) {} template - requires (::std::is_constructible_v && ::std::is_constructible_v) - constexpr pair(::std::pair const & other) : base_t(other.first, other.second) + requires (std::is_constructible_v && std::is_constructible_v) + constexpr pair(std::pair const & other) : base_t(other.first, other.second) {} template - requires (::std::is_constructible_v && ::std::is_constructible_v) - constexpr pair(::std::pair && other) : - base_t(::std::forward(other.first), ::std::forward(other.second)) + requires (std::is_constructible_v && std::is_constructible_v) + constexpr pair(std::pair && other) : base_t(std::forward(other.first), std::forward(other.second)) {} template - requires (::std::is_constructible_v && ::std::is_constructible_v) - constexpr pair(::std::pair const && other) : - base_t(::std::forward(other.first), ::std::forward(other.second)) + requires (std::is_constructible_v && std::is_constructible_v) + constexpr pair(std::pair const && other) : + base_t(std::forward(other.first), std::forward(other.second)) {} //!@} //!\} @@ -136,7 +135,7 @@ struct pair : public ::std::pair */ //!@{ Assigns from pair. template - requires (::std::is_assignable_v && ::std::is_assignable_v) + requires (std::is_assignable_v && std::is_assignable_v) constexpr pair & operator=(pair & other) { first = other.first; @@ -145,7 +144,7 @@ struct pair : public ::std::pair } template - requires (::std::is_assignable_v && ::std::is_assignable_v) + requires (std::is_assignable_v && std::is_assignable_v) constexpr pair & operator=(pair const & other) { first = other.first; @@ -154,25 +153,25 @@ struct pair : public ::std::pair } template - requires (::std::is_assignable_v && ::std::is_assignable_v) + requires (std::is_assignable_v && std::is_assignable_v) constexpr pair & operator=(pair && other) { - first = ::std::move(other.first); - second = ::std::move(other.second); + first = std::move(other.first); + second = std::move(other.second); return *this; } template - requires (::std::is_assignable_v && ::std::is_assignable_v) + requires (std::is_assignable_v && std::is_assignable_v) constexpr pair & operator=(pair const && other) { - first = ::std::move(other.first); - second = ::std::move(other.second); + first = std::move(other.first); + second = std::move(other.second); return *this; } template - requires (::std::is_assignable_v && ::std::is_assignable_v) + requires (std::is_assignable_v && std::is_assignable_v) constexpr pair const & operator=(pair & other) const { first = other.first; @@ -181,7 +180,7 @@ struct pair : public ::std::pair } template - requires (::std::is_assignable_v && ::std::is_assignable_v) + requires (std::is_assignable_v && std::is_assignable_v) constexpr pair const & operator=(pair const & other) const { first = other.first; @@ -190,32 +189,32 @@ struct pair : public ::std::pair } template - requires (::std::is_assignable_v && ::std::is_assignable_v) + requires (std::is_assignable_v && std::is_assignable_v) constexpr pair const & operator=(pair && other) const { - first = ::std::move(other.first); - second = ::std::move(other.second); + first = std::move(other.first); + second = std::move(other.second); return *this; } template - requires (::std::is_assignable_v && ::std::is_assignable_v) + requires (std::is_assignable_v && std::is_assignable_v) constexpr pair const & operator=(pair const && other) const { - first = ::std::move(other.first); - second = ::std::move(other.second); + first = std::move(other.first); + second = std::move(other.second); return *this; } //!@} //!\} - /*!\name Assign from ::std::pair. + /*!\name Assign from std::pair. * \{ */ - //!@{ Assigns from ::std::pair. + //!@{ Assigns from std::pair. template - requires (::std::is_assignable_v && ::std::is_assignable_v) - constexpr pair & operator=(::std::pair & other) + requires (std::is_assignable_v && std::is_assignable_v) + constexpr pair & operator=(std::pair & other) { first = other.first; second = other.second; @@ -223,8 +222,8 @@ struct pair : public ::std::pair } template - requires (::std::is_assignable_v && ::std::is_assignable_v) - constexpr pair & operator=(::std::pair const & other) + requires (std::is_assignable_v && std::is_assignable_v) + constexpr pair & operator=(std::pair const & other) { first = other.first; second = other.second; @@ -232,26 +231,26 @@ struct pair : public ::std::pair } template - requires (::std::is_assignable_v && ::std::is_assignable_v) - constexpr pair & operator=(::std::pair && other) + requires (std::is_assignable_v && std::is_assignable_v) + constexpr pair & operator=(std::pair && other) { - first = ::std::move(other.first); - second = ::std::move(other.second); + first = std::move(other.first); + second = std::move(other.second); return *this; } template - requires (::std::is_assignable_v && ::std::is_assignable_v) - constexpr pair & operator=(::std::pair const && other) + requires (std::is_assignable_v && std::is_assignable_v) + constexpr pair & operator=(std::pair const && other) { - first = ::std::move(other.first); - second = ::std::move(other.second); + first = std::move(other.first); + second = std::move(other.second); return *this; } template - requires (::std::is_assignable_v && ::std::is_assignable_v) - constexpr pair const & operator=(::std::pair & other) const + requires (std::is_assignable_v && std::is_assignable_v) + constexpr pair const & operator=(std::pair & other) const { first = other.first; second = other.second; @@ -259,8 +258,8 @@ struct pair : public ::std::pair } template - requires (::std::is_assignable_v && ::std::is_assignable_v) - constexpr pair const & operator=(::std::pair const & other) const + requires (std::is_assignable_v && std::is_assignable_v) + constexpr pair const & operator=(std::pair const & other) const { first = other.first; second = other.second; @@ -268,55 +267,55 @@ struct pair : public ::std::pair } template - requires (::std::is_assignable_v && ::std::is_assignable_v) - constexpr pair const & operator=(::std::pair && other) const + requires (std::is_assignable_v && std::is_assignable_v) + constexpr pair const & operator=(std::pair && other) const { - first = ::std::move(other.first); - second = ::std::move(other.second); + first = std::move(other.first); + second = std::move(other.second); return *this; } template - requires (::std::is_assignable_v && ::std::is_assignable_v) - constexpr pair const & operator=(::std::pair const && other) const + requires (std::is_assignable_v && std::is_assignable_v) + constexpr pair const & operator=(std::pair const && other) const { - first = ::std::move(other.first); - second = ::std::move(other.second); + first = std::move(other.first); + second = std::move(other.second); return *this; } //!@} //!\} - /*!\name Conversion to ::std::pair. + /*!\name Conversion to std::pair. * \{ */ - //!@{ Converts to ::std::pair + //!@{ Converts to std::pair template - requires (::std::is_constructible_v && ::std::is_constructible_v) - operator ::std::pair() & + requires (std::is_constructible_v && std::is_constructible_v) + operator std::pair() & { return {first, second}; } template - requires (::std::is_constructible_v && ::std::is_constructible_v) - operator ::std::pair() const & + requires (std::is_constructible_v && std::is_constructible_v) + operator std::pair() const & { return {first, second}; } template - requires (::std::is_constructible_v && ::std::is_constructible_v) - operator ::std::pair() && + requires (std::is_constructible_v && std::is_constructible_v) + operator std::pair() && { - return {::std::move(first), ::std::move(second)}; + return {std::move(first), std::move(second)}; } template - requires (::std::is_constructible_v && ::std::is_constructible_v) - operator ::std::pair() const && + requires (std::is_constructible_v && std::is_constructible_v) + operator std::pair() const && { - return {::std::move(first), ::std::move(second)}; + return {std::move(first), std::move(second)}; } //!@} //!\} @@ -332,7 +331,7 @@ struct pair : public ::std::pair * \returns A bool indicating the result of the comparison. */ template - requires (::std::equality_comparable_with && ::std::equality_comparable_with) + requires (std::equality_comparable_with && std::equality_comparable_with) constexpr friend bool operator==(pair const & lhs, pair const & rhs) { return lhs.first == rhs.first && lhs.second == rhs.second; @@ -346,7 +345,7 @@ struct pair : public ::std::pair * \returns A bool indicating the result of the comparison. */ template - requires (::std::equality_comparable_with && ::std::equality_comparable_with) + requires (std::equality_comparable_with && std::equality_comparable_with) constexpr friend bool operator!=(pair const & lhs, pair const & rhs) { return lhs.first != rhs.first && lhs.second != rhs.second; @@ -360,7 +359,7 @@ struct pair : public ::std::pair * \returns A bool indicating the result of the comparison. */ template - requires (::std::totally_ordered_with && ::std::totally_ordered_with) + requires (std::totally_ordered_with && std::totally_ordered_with) constexpr friend bool operator<(pair const & lhs, pair const & rhs) { return lhs.first < rhs.first && lhs.second < rhs.second; @@ -374,7 +373,7 @@ struct pair : public ::std::pair * \returns A bool indicating the result of the comparison. */ template - requires (::std::totally_ordered_with && ::std::totally_ordered_with) + requires (std::totally_ordered_with && std::totally_ordered_with) constexpr friend bool operator<=(pair const & lhs, pair const & rhs) { return lhs.first <= rhs.first && lhs.second <= rhs.second; @@ -388,7 +387,7 @@ struct pair : public ::std::pair * \returns A bool indicating the result of the comparison. */ template - requires (::std::totally_ordered_with && ::std::totally_ordered_with) + requires (std::totally_ordered_with && std::totally_ordered_with) constexpr friend bool operator>(pair const & lhs, pair const & rhs) { return lhs.first > rhs.first && lhs.second > rhs.second; @@ -402,7 +401,7 @@ struct pair : public ::std::pair * \returns A bool indicating the result of the comparison. */ template - requires (::std::totally_ordered_with && ::std::totally_ordered_with) + requires (std::totally_ordered_with && std::totally_ordered_with) constexpr friend bool operator>=(pair const & lhs, pair const & rhs) { return lhs.first >= rhs.first && lhs.second >= rhs.second; @@ -418,9 +417,9 @@ struct pair : public ::std::pair * indicating the result of the comparison. */ template - requires (::std::three_way_comparable_with && ::std::three_way_comparable_with) - constexpr friend ::std::common_comparison_category_t<::std::compare_three_way_result_t, - ::std::compare_three_way_result_t> + requires (std::three_way_comparable_with && std::three_way_comparable_with) + constexpr friend std::common_comparison_category_t, + std::compare_three_way_result_t> operator<=>(pair const & lhs, pair const & rhs) { if (auto cmp = lhs.first <=> rhs.first; cmp != 0) @@ -430,19 +429,19 @@ struct pair : public ::std::pair # endif // __cpp_lib_three_way_comparison //!\} - /*!\name Comparison operators (::std::pair) + /*!\name Comparison operators (std::pair) * \{ */ /*!\brief Checks whether `lhs` and `rhs` are equal. * \tparam U1 The type of the first element of `rhs`. Automatically deduced. * \tparam U2 The type of the second element of `rhs`. Automatically deduced. * \param lhs A pair. - * \param rhs A ::std::pair with possibly different element types. + * \param rhs A std::pair with possibly different element types. * \returns A bool indicating the result of the comparison. */ template - requires (::std::equality_comparable_with && ::std::equality_comparable_with) - constexpr friend bool operator==(pair const & lhs, ::std::pair const & rhs) + requires (std::equality_comparable_with && std::equality_comparable_with) + constexpr friend bool operator==(pair const & lhs, std::pair const & rhs) { return lhs.first == rhs.first && lhs.second == rhs.second; } @@ -451,12 +450,12 @@ struct pair : public ::std::pair * \tparam U1 The type of the first element of `rhs`. Automatically deduced. * \tparam U2 The type of the second element of `rhs`. Automatically deduced. * \param lhs A pair. - * \param rhs A ::std::pair with possibly different element types. + * \param rhs A std::pair with possibly different element types. * \returns A bool indicating the result of the comparison. */ template - requires (::std::equality_comparable_with && ::std::equality_comparable_with) - constexpr friend bool operator!=(pair const & lhs, ::std::pair const & rhs) + requires (std::equality_comparable_with && std::equality_comparable_with) + constexpr friend bool operator!=(pair const & lhs, std::pair const & rhs) { return lhs.first != rhs.first && lhs.second != rhs.second; } @@ -465,12 +464,12 @@ struct pair : public ::std::pair * \tparam U1 The type of the first element of `rhs`. Automatically deduced. * \tparam U2 The type of the second element of `rhs`. Automatically deduced. * \param lhs A pair. - * \param rhs A ::std::pair with possibly different element types. + * \param rhs A std::pair with possibly different element types. * \returns A bool indicating the result of the comparison. */ template - requires (::std::totally_ordered_with && ::std::totally_ordered_with) - constexpr friend bool operator<(pair const & lhs, ::std::pair const & rhs) + requires (std::totally_ordered_with && std::totally_ordered_with) + constexpr friend bool operator<(pair const & lhs, std::pair const & rhs) { return lhs.first < rhs.first && lhs.second < rhs.second; } @@ -479,12 +478,12 @@ struct pair : public ::std::pair * \tparam U1 The type of the first element of `rhs`. Automatically deduced. * \tparam U2 The type of the second element of `rhs`. Automatically deduced. * \param lhs A pair. - * \param rhs A ::std::pair with possibly different element types. + * \param rhs A std::pair with possibly different element types. * \returns A bool indicating the result of the comparison. */ template - requires (::std::totally_ordered_with && ::std::totally_ordered_with) - constexpr friend bool operator<=(pair const & lhs, ::std::pair const & rhs) + requires (std::totally_ordered_with && std::totally_ordered_with) + constexpr friend bool operator<=(pair const & lhs, std::pair const & rhs) { return lhs.first <= rhs.first && lhs.second <= rhs.second; } @@ -493,12 +492,12 @@ struct pair : public ::std::pair * \tparam U1 The type of the first element of `rhs`. Automatically deduced. * \tparam U2 The type of the second element of `rhs`. Automatically deduced. * \param lhs A pair. - * \param rhs A ::std::pair with possibly different element types. + * \param rhs A std::pair with possibly different element types. * \returns A bool indicating the result of the comparison. */ template - requires (::std::totally_ordered_with && ::std::totally_ordered_with) - constexpr friend bool operator>(pair const & lhs, ::std::pair const & rhs) + requires (std::totally_ordered_with && std::totally_ordered_with) + constexpr friend bool operator>(pair const & lhs, std::pair const & rhs) { return lhs.first > rhs.first && lhs.second > rhs.second; } @@ -507,12 +506,12 @@ struct pair : public ::std::pair * \tparam U1 The type of the first element of `rhs`. Automatically deduced. * \tparam U2 The type of the second element of `rhs`. Automatically deduced. * \param lhs A pair. - * \param rhs A ::std::pair with possibly different element types. + * \param rhs A std::pair with possibly different element types. * \returns A bool indicating the result of the comparison. */ template - requires (::std::totally_ordered_with && ::std::totally_ordered_with) - constexpr friend bool operator>=(pair const & lhs, ::std::pair const & rhs) + requires (std::totally_ordered_with && std::totally_ordered_with) + constexpr friend bool operator>=(pair const & lhs, std::pair const & rhs) { return lhs.first >= rhs.first && lhs.second >= rhs.second; } @@ -522,15 +521,15 @@ struct pair : public ::std::pair * \tparam U1 The type of the first element of `rhs`. Automatically deduced. * \tparam U2 The type of the second element of `rhs`. Automatically deduced. * \param lhs A pair. - * \param rhs A ::std::pair with possibly different element types. + * \param rhs A std::pair with possibly different element types. * \returns An [ordering](https://en.cppreference.com/w/cpp/language/operator_comparison#Three-way_comparison) * indicating the result of the comparison. */ template - requires (::std::three_way_comparable_with && ::std::three_way_comparable_with) - constexpr friend ::std::common_comparison_category_t<::std::compare_three_way_result_t, - ::std::compare_three_way_result_t> - operator<=>(pair const & lhs, ::std::pair const & rhs) + requires (std::three_way_comparable_with && std::three_way_comparable_with) + constexpr friend std::common_comparison_category_t, + std::compare_three_way_result_t> + operator<=>(pair const & lhs, std::pair const & rhs) { if (auto cmp = lhs.first <=> rhs.first; cmp != 0) return cmp; @@ -544,127 +543,127 @@ struct pair : public ::std::pair template pair(T1, T2) -> pair; -} // namespace seqan::std +} // namespace seqan::stl namespace std { template -struct tuple_size> : public tuple_size<::std::pair> +struct tuple_size> : public tuple_size> {}; template -struct tuple_element> : public tuple_element> +struct tuple_element> : public tuple_element> {}; template - requires requires { typename seqan::std::pair<::std::common_type_t, ::std::common_type_t>; } -struct common_type, seqan::std::pair> + requires requires { typename seqan::stl::pair, std::common_type_t>; } +struct common_type, seqan::stl::pair> { - using type = seqan::std::pair<::std::common_type_t, ::std::common_type_t>; + using type = seqan::stl::pair, std::common_type_t>; }; template - requires requires { typename seqan::std::pair<::std::common_type_t, ::std::common_type_t>; } -struct common_type<::std::pair, seqan::std::pair> + requires requires { typename seqan::stl::pair, std::common_type_t>; } +struct common_type, seqan::stl::pair> { - using type = seqan::std::pair<::std::common_type_t, ::std::common_type_t>; + using type = seqan::stl::pair, std::common_type_t>; }; template - requires requires { typename seqan::std::pair<::std::common_type_t, ::std::common_type_t>; } -struct common_type, ::std::pair> + requires requires { typename seqan::stl::pair, std::common_type_t>; } +struct common_type, std::pair> { - using type = seqan::std::pair<::std::common_type_t, ::std::common_type_t>; + using type = seqan::stl::pair, std::common_type_t>; }; template class TQual, template class UQual> requires requires { - typename seqan::std::pair<::std::common_reference_t, UQual>, - ::std::common_reference_t, UQual>>; + typename seqan::stl::pair, UQual>, + std::common_reference_t, UQual>>; } -struct basic_common_reference, seqan::std::pair, TQual, UQual> +struct basic_common_reference, seqan::stl::pair, TQual, UQual> { - using type = seqan::std::pair<::std::common_reference_t, UQual>, - ::std::common_reference_t, UQual>>; + using type = + seqan::stl::pair, UQual>, std::common_reference_t, UQual>>; }; template class TQual, template class UQual> requires requires { - typename seqan::std::pair<::std::common_reference_t, UQual>, - ::std::common_reference_t, UQual>>; + typename seqan::stl::pair, UQual>, + std::common_reference_t, UQual>>; } -struct basic_common_reference<::std::pair, seqan::std::pair, TQual, UQual> +struct basic_common_reference, seqan::stl::pair, TQual, UQual> { - using type = seqan::std::pair<::std::common_reference_t, UQual>, - ::std::common_reference_t, UQual>>; + using type = + seqan::stl::pair, UQual>, std::common_reference_t, UQual>>; }; template class TQual, template class UQual> requires requires { - typename seqan::std::pair<::std::common_reference_t, UQual>, - ::std::common_reference_t, UQual>>; + typename seqan::stl::pair, UQual>, + std::common_reference_t, UQual>>; } -struct basic_common_reference, ::std::pair, TQual, UQual> +struct basic_common_reference, std::pair, TQual, UQual> { - using type = seqan::std::pair<::std::common_reference_t, UQual>, - ::std::common_reference_t, UQual>>; + using type = + seqan::stl::pair, UQual>, std::common_reference_t, UQual>>; }; -template <::std::size_t i, class T1, class T2> -constexpr ::std::tuple_element_t> & get(seqan::std::pair & t) noexcept +template +constexpr std::tuple_element_t> & get(seqan::stl::pair & t) noexcept requires (i < 2) { - return ::std::get(static_cast<::std::pair &>(t)); + return std::get(static_cast &>(t)); } -template <::std::size_t i, class T1, class T2> -constexpr ::std::tuple_element_t> const & get(seqan::std::pair const & t) noexcept +template +constexpr std::tuple_element_t> const & get(seqan::stl::pair const & t) noexcept requires (i < 2) { - return ::std::get(static_cast<::std::pair const &>(t)); + return std::get(static_cast const &>(t)); } -template <::std::size_t i, class T1, class T2> -constexpr ::std::tuple_element_t> && get(seqan::std::pair && t) noexcept +template +constexpr std::tuple_element_t> && get(seqan::stl::pair && t) noexcept requires (i < 2) { - return ::std::get(static_cast<::std::pair &&>(::std::move(t))); + return std::get(static_cast &&>(std::move(t))); } -template <::std::size_t i, class T1, class T2> -constexpr ::std::tuple_element_t> const && get(seqan::std::pair const && t) noexcept +template +constexpr std::tuple_element_t> const && get(seqan::stl::pair const && t) noexcept requires (i < 2) { - return ::std::get(static_cast<::std::pair const &&>(::std::move(t))); + return std::get(static_cast const &&>(std::move(t))); } template -constexpr type & get(seqan::std::pair & t) noexcept - requires (!::std::same_as) +constexpr type & get(seqan::stl::pair & t) noexcept + requires (!std::same_as) { - return ::std::get(static_cast<::std::pair &>(t)); + return std::get(static_cast &>(t)); } template -constexpr type const & get(seqan::std::pair const & t) noexcept - requires (!::std::same_as) +constexpr type const & get(seqan::stl::pair const & t) noexcept + requires (!std::same_as) { - return ::std::get(static_cast<::std::pair const &>(t)); + return std::get(static_cast const &>(t)); } template -constexpr type && get(seqan::std::pair && t) noexcept - requires (!::std::same_as) +constexpr type && get(seqan::stl::pair && t) noexcept + requires (!std::same_as) { - return ::std::get(static_cast<::std::pair &&>(::std::move(t))); + return std::get(static_cast &&>(std::move(t))); } template -constexpr type const && get(seqan::std::pair const && t) noexcept - requires (!::std::same_as) +constexpr type const && get(seqan::stl::pair const && t) noexcept + requires (!std::same_as) { - return ::std::get(static_cast<::std::pair const &&>(::std::move(t))); + return std::get(static_cast const &&>(std::move(t))); } } // namespace std diff --git a/to.hpp b/to.hpp index d144a820..fc66f920 100644 --- a/to.hpp +++ b/to.hpp @@ -7,7 +7,7 @@ /*!\file * \author Enrico Seiler - * \brief Provides seqan::std::ranges::to. + * \brief Provides seqan::stl::ranges::to. */ // File might be included from multiple libraries. @@ -18,21 +18,21 @@ #ifdef __cpp_lib_ranges_to_container -namespace seqan::std +namespace seqan::stl { -using ::std::from_range_t; +using std::from_range_t; inline constexpr from_range_t from_range{}; -} // namespace seqan::std +} // namespace seqan::stl -namespace seqan::std::ranges +namespace seqan::stl::ranges { -using ::std::ranges::to; +using std::ranges::to; -} // namespace seqan::std::ranges +} // namespace seqan::stl::ranges #else @@ -40,7 +40,7 @@ using ::std::ranges::to; # include "detail/adaptor_from_functor.hpp" -namespace seqan::std +namespace seqan::stl { struct from_range_t @@ -50,20 +50,20 @@ struct from_range_t inline constexpr from_range_t from_range{}; -} // namespace seqan::std +} // namespace seqan::stl -namespace seqan::std::detail::to +namespace seqan::stl::detail::to { // clang-format off template constexpr bool reservable_container = - ::std::ranges::sized_range && - requires (Container & c, ::std::ranges::range_size_t n) + std::ranges::sized_range && + requires (Container & c, std::ranges::range_size_t n) { c.reserve(n); - { c.capacity() } -> ::std::same_as; - { c.max_size() } -> ::std::same_as; + { c.capacity() } -> std::same_as; + { c.max_size() } -> std::same_as; }; template @@ -72,8 +72,8 @@ constexpr bool container_insertable = { requires ( - requires { c.push_back(::std::forward(ref)); } || - requires { c.insert(c.end(), ::std::forward(ref)); } + requires { c.push_back(std::forward(ref)); } || + requires { c.insert(c.end(), std::forward(ref)); } ); }; // clang-format on @@ -81,20 +81,20 @@ constexpr bool container_insertable = template constexpr auto container_inserter(Container & c) { - if constexpr (requires { c.push_back(::std::declval()); }) - return ::std::back_inserter(c); + if constexpr (requires { c.push_back(std::declval()); }) + return std::back_inserter(c); else - return ::std::inserter(c, c.end()); + return std::inserter(c, c.end()); } -template <::std::ranges::input_range R> +template struct input_iterator { - using iterator_category = ::std::input_iterator_tag; - using value_type = ::std::ranges::range_value_t; - using difference_type = ::std::ptrdiff_t; - using pointer = ::std::add_pointer_t<::std::ranges::range_reference_t>; - using reference = ::std::ranges::range_reference_t; + using iterator_category = std::input_iterator_tag; + using value_type = std::ranges::range_value_t; + using difference_type = std::ptrdiff_t; + using pointer = std::add_pointer_t>; + using reference = std::ranges::range_reference_t; reference operator*() const; pointer operator->() const; @@ -105,94 +105,92 @@ struct input_iterator template concept has_input_iterator_category = - ::std::derived_from::iterator_category, ::std::input_iterator_tag>; + std::derived_from::iterator_category, std::input_iterator_tag>; -} // namespace seqan::std::detail::to +} // namespace seqan::stl::detail::to -namespace seqan::std::ranges +namespace seqan::stl::ranges { -template - requires (!::std::ranges::view) +template + requires (!std::ranges::view) constexpr C to(R && r, Args &&... args) { - if constexpr (!::std::ranges::input_range - || ::std::convertible_to<::std::ranges::range_reference_t, ::std::ranges::range_value_t>) + if constexpr (!std::ranges::input_range + || std::convertible_to, std::ranges::range_value_t>) { - if constexpr (::std::constructible_from) - return C(::std::forward(r), ::std::forward(args)...); - else if constexpr (::std::constructible_from) - return C(seqan::std::from_range, ::std::forward(r), ::std::forward(args)...); - else if constexpr (::std::ranges::common_range - && seqan::std::detail::to::has_input_iterator_category<::std::ranges::iterator_t> - && ::std::constructible_from, - ::std::ranges::sentinel_t, - Args...>) - return C(::std::ranges::begin(r), ::std::ranges::end(r), ::std::forward(args)...); - else if constexpr (::std::constructible_from - && seqan::std::detail::to::container_insertable>) + if constexpr (std::constructible_from) + return C(std::forward(r), std::forward(args)...); + else if constexpr (std::constructible_from) + return C(seqan::stl::from_range, std::forward(r), std::forward(args)...); + else if constexpr (std::ranges::common_range + && seqan::stl::detail::to::has_input_iterator_category> + && std:: + constructible_from, std::ranges::sentinel_t, Args...>) + return C(std::ranges::begin(r), std::ranges::end(r), std::forward(args)...); + else if constexpr (std::constructible_from + && seqan::stl::detail::to::container_insertable>) { - C c(::std::forward(args)...); - if constexpr (::std::ranges::sized_range && seqan::std::detail::to::reservable_container) - c.reserve(static_cast<::std::ranges::range_size_t>(::std::ranges::size(r))); - ::std::ranges::copy(r, seqan::std::detail::to::container_inserter<::std::ranges::range_reference_t>(c)); + C c(std::forward(args)...); + if constexpr (std::ranges::sized_range && seqan::stl::detail::to::reservable_container) + c.reserve(static_cast>(std::ranges::size(r))); + std::ranges::copy(r, seqan::stl::detail::to::container_inserter>(c)); return c; } } - else if constexpr (::std::ranges::input_range<::std::ranges::range_reference_t>) + else if constexpr (std::ranges::input_range>) return to(r - | ::std::views::transform( + | std::views::transform( [](auto && elem) { - return to<::std::ranges::range_value_t>(::std::forward(elem)); + return to>(std::forward(elem)); }), - ::std::forward(args)...); + std::forward(args)...); else __builtin_unreachable(); } -template