+ /**
+ * Move assignment operator, only assigns the data, NOT the
+ * mutex. It locks the two objects in ascending order of their
+ * addresses.
+ */
+ Synchronized& operator=(Synchronized&& rhs) {
+ if (this == &rhs) {
+ // Self-assignment, pass.
+ } else if (this < &rhs) {
+ auto guard1 = operator->();
+ auto guard2 = rhs.operator->();
+ datum_ = std::move(rhs.datum_);
+ } else {
+ auto guard1 = rhs.operator->();
+ auto guard2 = operator->();
+ datum_ = std::move(rhs.datum_);
+ }
+ return *this;
+ }
+