@@ -75,6 +75,12 @@ public:
7575 }
7676 }
7777
78+ template <underlying_type U>
79+ requires (!std::same_as<U, value_type>)
80+ explicit constexpr primitive (primitive<U, Policies...> const &other) noexcept
81+ requires(cross_underlying_constructible_v<U>)
82+ : value_(convert_cross_underlying_<U>(other.load())) {}
83+
7884 constexpr auto operator =(primitive const &other) noexcept -> primitive & {
7985 if (this == &other) {
8086 return *this ;
@@ -88,6 +94,15 @@ public:
8894 return *this ;
8995 }
9096
97+ template <underlying_type U>
98+ requires (!std::same_as<U, value_type>)
99+ constexpr auto
100+ operator =(primitive<U, Policies...> const &other) noexcept -> primitive &
101+ requires (cross_underlying_constructible_v<U>) {
102+ store (convert_cross_underlying_<U>(other.load ()));
103+ return *this ;
104+ }
105+
91106 constexpr primitive (primitive &&other) noexcept {
92107 if consteval {
93108 value_ = other.value_ ;
@@ -96,6 +111,12 @@ public:
96111 }
97112 }
98113
114+ template <underlying_type U>
115+ requires (!std::same_as<U, value_type>)
116+ explicit constexpr primitive (primitive<U, Policies...> &&other) noexcept
117+ requires(cross_underlying_constructible_v<U>)
118+ : value_(convert_cross_underlying_<U>(other.load())) {}
119+
99120 constexpr auto operator =(primitive &&other) noexcept -> primitive & {
100121 if (this == &other) {
101122 return *this ;
@@ -109,6 +130,15 @@ public:
109130 return *this ;
110131 }
111132
133+ template <underlying_type U>
134+ requires (!std::same_as<U, value_type>)
135+ constexpr auto operator =(primitive<U, Policies...> &&other) noexcept
136+ -> primitive &
137+ requires (cross_underlying_constructible_v<U>) {
138+ store (convert_cross_underlying_<U>(other.load ()));
139+ return *this ;
140+ }
141+
112142 constexpr value_type &value () noexcept { return value_; }
113143
114144 [[nodiscard]] constexpr value_type const &value () const noexcept {
0 commit comments