Skip to content

Commit ab3eedf

Browse files
committed
Fix middle argument to 'enable_from_other' for construct/assign from 'optional<U&>'
1 parent c891a22 commit ab3eedf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/beman/optional26/optional.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,11 @@ class optional {
294294

295295
template <class U>
296296
constexpr explicit(!std::is_convertible_v<U&, T>) optional(const optional<U&>& rhs)
297-
requires(detail::enable_from_other<T, U, U&> && std::is_convertible_v<U&, T>);
297+
requires(detail::enable_from_other<T, U&, U&> && std::is_convertible_v<U&, T>);
298298

299299
template <class U>
300300
constexpr explicit(!std::is_convertible_v<U&, T>) optional(const optional<U&>& rhs)
301-
requires(detail::enable_from_other<T, U, U&> && !std::is_convertible_v<U&, T>);
301+
requires(detail::enable_from_other<T, U&, U&> && !std::is_convertible_v<U&, T>);
302302

303303
// \ref{optional.dtor}, destructor
304304
constexpr ~optional()
@@ -341,7 +341,7 @@ class optional {
341341

342342
template <class U>
343343
constexpr optional& operator=(const optional<U&>& rhs)
344-
requires(detail::enable_assign_from_other<T, U, U&>);
344+
requires(detail::enable_assign_from_other<T, U&, U&>);
345345

346346
template <class... Args>
347347
constexpr T& emplace(Args&&... args);
@@ -521,7 +521,7 @@ inline constexpr optional<T>::optional(optional<U>&& rhs)
521521
template <class T>
522522
template <class U>
523523
inline constexpr optional<T>::optional(const optional<U&>& rhs)
524-
requires(detail::enable_from_other<T, U, U&> && std::is_convertible_v<U&, T>)
524+
requires(detail::enable_from_other<T, U&, U&> && std::is_convertible_v<U&, T>)
525525
{
526526
if (rhs.has_value()) {
527527
construct(*rhs);
@@ -531,7 +531,7 @@ inline constexpr optional<T>::optional(const optional<U&>& rhs)
531531
template <class T>
532532
template <class U>
533533
inline constexpr optional<T>::optional(const optional<U&>& rhs)
534-
requires(detail::enable_from_other<T, U, U&> && !std::is_convertible_v<U&, T>)
534+
requires(detail::enable_from_other<T, U&, U&> && !std::is_convertible_v<U&, T>)
535535
{
536536
if (rhs.has_value()) {
537537
construct(*rhs);
@@ -646,7 +646,7 @@ inline constexpr optional<T>& optional<T>::operator=(optional<U>&& rhs)
646646
template <class T>
647647
template <class U>
648648
inline constexpr optional<T>& optional<T>::operator=(const optional<U&>& rhs)
649-
requires(detail::enable_assign_from_other<T, U, U&>)
649+
requires(detail::enable_assign_from_other<T, U&, U&>)
650650
{
651651
if (has_value()) {
652652
if (rhs.has_value()) {

0 commit comments

Comments
 (0)