Skip to content

Commit 65e92c4

Browse files
committed
Use std::swap, mark T& assignment and __swap noexcept
1 parent 85db654 commit 65e92c4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

libcxx/include/optional

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,13 +476,12 @@ struct __optional_storage_base<_Tp, true> {
476476
}
477477

478478
template <class _Up>
479-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from_val(_Up&& __val) {
479+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from_val(_Up&& __val) noexcept {
480480
__value_ = std::addressof(__val);
481481
}
482482

483-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __swap(__optional_storage_base& __rhs) {
484-
using std::swap;
485-
swap(__value_, __rhs.__value_);
483+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __swap(__optional_storage_base& __rhs) noexcept {
484+
std::swap(__value_, __rhs.__value_);
486485
}
487486
};
488487

0 commit comments

Comments
 (0)