Skip to content

Commit 31a4a3e

Browse files
authored
Merge pull request #3328 from eseiler/infra/update_stl
[INFRA] Update stl
2 parents d50f050 + bb76dfc commit 31a4a3e

File tree

4 files changed

+380
-5
lines changed

4 files changed

+380
-5
lines changed

include/seqan3/contrib/std/LICENSE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Copyright (c) 2006-2024, Knut Reinert & Freie Universität Berlin
2-
Copyright (c) 2016-2024, Knut Reinert & MPI für molekulare Genetik
1+
Copyright (c) 2006-2025, Knut Reinert & Freie Universität Berlin
2+
Copyright (c) 2016-2025, Knut Reinert & MPI für molekulare Genetik
33
All rights reserved.
44

55
Redistribution and use in source and binary forms, with or without

include/seqan3/contrib/std/detail/exposition_only.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ concept simple_view = std::ranges::view<range_t> && std::ranges::range<range_t c
3030
template <bool is_const, typename t>
3131
using maybe_const = std::conditional_t<is_const, t const, t>;
3232

33+
template <class R>
34+
concept range_with_movable_references =
35+
std::ranges::input_range<R> && std::move_constructible<std::ranges::range_reference_t<R>>
36+
&& std::move_constructible<std::ranges::range_rvalue_reference_t<R>>;
37+
3338
} // namespace seqan::stl::detail
3439

3540
#endif // SEQAN_STD_DETAIL_EXPOSITION_ONLY

include/seqan3/contrib/std/detail/movable_box.hpp

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ class movable_box : public std::optional<t>
7777
};
7878

7979
template <boxable t>
80-
requires std::copyable<t> || (std::is_nothrow_move_constructible_v<t> && std::is_nothrow_copy_constructible_v<t>)
80+
requires std::copyable<t>
81+
|| (std::is_copy_constructible_v<t> && std::is_nothrow_move_constructible_v<t>
82+
&& std::is_nothrow_copy_constructible_v<t>)
83+
|| (!std::is_copy_constructible_v<t> && (std::movable<t> || std::is_nothrow_move_constructible_v<t>))
8184
class movable_box<t>
8285
{
8386
private:
@@ -92,13 +95,39 @@ class movable_box<t>
9295
constexpr movable_box(movable_box &&) = default;
9396
constexpr ~movable_box() = default;
9497

95-
constexpr movable_box & operator=(movable_box const &) = default;
98+
constexpr movable_box & operator=(movable_box const &)
99+
requires std::copyable<t>
100+
= default;
96101

97-
constexpr movable_box & operator=(movable_box &&) = default;
102+
constexpr movable_box & operator=(movable_box &&)
103+
requires std::movable<t>
104+
= default;
98105

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

109+
constexpr movable_box & operator=(movable_box const & other) noexcept(std::is_nothrow_copy_constructible_v<t>)
110+
requires (!std::copyable<t> && std::copy_constructible<t>)
111+
{
112+
if (this != std::addressof(other))
113+
{
114+
value.~t();
115+
std::construct_at(std::addressof(value), other.value);
116+
}
117+
return *this;
118+
}
119+
120+
constexpr movable_box & operator=(movable_box && other) noexcept(std::is_nothrow_move_constructible_v<t>)
121+
requires (!std::movable<t>)
122+
{
123+
if (this != std::addressof(other))
124+
{
125+
value.~t();
126+
std::construct_at(std::addressof(value), std::move(other.value));
127+
}
128+
return *this;
129+
}
130+
102131
constexpr explicit movable_box(t && other) noexcept(std::is_nothrow_move_constructible_v<t>) :
103132
value{std::move(other)}
104133
{}

0 commit comments

Comments
 (0)