Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INFRA] Update stl #3328

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/seqan3/contrib/std/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Copyright (c) 2006-2024, Knut Reinert & Freie Universität Berlin
Copyright (c) 2016-2024, Knut Reinert & MPI für molekulare Genetik
Copyright (c) 2006-2025, Knut Reinert & Freie Universität Berlin
Copyright (c) 2016-2025, Knut Reinert & MPI für molekulare Genetik
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
5 changes: 5 additions & 0 deletions include/seqan3/contrib/std/detail/exposition_only.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ concept simple_view = std::ranges::view<range_t> && std::ranges::range<range_t c
template <bool is_const, typename t>
using maybe_const = std::conditional_t<is_const, t const, t>;

template <class R>
concept range_with_movable_references =
std::ranges::input_range<R> && std::move_constructible<std::ranges::range_reference_t<R>>
&& std::move_constructible<std::ranges::range_rvalue_reference_t<R>>;

} // namespace seqan::stl::detail

#endif // SEQAN_STD_DETAIL_EXPOSITION_ONLY
35 changes: 32 additions & 3 deletions include/seqan3/contrib/std/detail/movable_box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ class movable_box : public std::optional<t>
};

template <boxable t>
requires std::copyable<t> || (std::is_nothrow_move_constructible_v<t> && std::is_nothrow_copy_constructible_v<t>)
requires std::copyable<t>
|| (std::is_copy_constructible_v<t> && std::is_nothrow_move_constructible_v<t>
&& std::is_nothrow_copy_constructible_v<t>)
|| (!std::is_copy_constructible_v<t> && (std::movable<t> || std::is_nothrow_move_constructible_v<t>))
class movable_box<t>
{
private:
Expand All @@ -92,13 +95,39 @@ class movable_box<t>
constexpr movable_box(movable_box &&) = default;
constexpr ~movable_box() = default;

constexpr movable_box & operator=(movable_box const &) = default;
constexpr movable_box & operator=(movable_box const &)
requires std::copyable<t>
= default;

constexpr movable_box & operator=(movable_box &&) = default;
constexpr movable_box & operator=(movable_box &&)
requires std::movable<t>
= default;

constexpr explicit movable_box(t const & other) noexcept(std::is_nothrow_copy_constructible_v<t>) : value{other}
{}

constexpr movable_box & operator=(movable_box const & other) noexcept(std::is_nothrow_copy_constructible_v<t>)
requires (!std::copyable<t> && std::copy_constructible<t>)
{
if (this != std::addressof(other))
{
value.~t();
std::construct_at(std::addressof(value), other.value);
}
return *this;
}

constexpr movable_box & operator=(movable_box && other) noexcept(std::is_nothrow_move_constructible_v<t>)
requires (!std::movable<t>)
{
if (this != std::addressof(other))
{
value.~t();
std::construct_at(std::addressof(value), std::move(other.value));
}
return *this;
}

constexpr explicit movable_box(t && other) noexcept(std::is_nothrow_move_constructible_v<t>) :
value{std::move(other)}
{}
Expand Down
Loading
Loading