Skip to content

Commit 55d13fc

Browse files
committed
Fix maybe again for non-copy/move types
1 parent 320f736 commit 55d13fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Rx/v2/src/rxcpp/rx-util.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,19 +637,19 @@ class maybe
637637

638638
template<class U = T>
639639
void reset(U&& value) {
640-
*this = std::forward<U>(value);
640+
val_.emplace(std::forward<U>(value));
641641
}
642642

643643
maybe& operator=(const maybe& other) = default;
644644
maybe& operator=(maybe&& other) = default;
645645

646646
maybe& operator=(const T& value) {
647-
val_ = value;
647+
reset(value);
648648
return *this;
649649
}
650650

651651
maybe& operator=(T&& value) {
652-
val_ = std::move(value);
652+
reset(std::move(value));
653653
return *this;
654654
}
655655
};

0 commit comments

Comments
 (0)