darion-yaphet commented on code in PR #3685:
URL: https://github.com/apache/brpc/pull/3685#discussion_r4455245096


##########
src/butil/memory/scoped_vector.h:
##########
@@ -37,13 +34,16 @@ class ScopedVector {
 
   ScopedVector() {}
   ~ScopedVector() { clear(); }
-  ScopedVector(RValue other) { swap(*other.object); }
-#if __cplusplus >= 201103L  // >= C++11
+  ScopedVector(const ScopedVector&) = delete;
+  ScopedVector& operator=(const ScopedVector&) = delete;
+  ScopedVector(ScopedVector&& other) noexcept { swap(other); }
   ScopedVector(std::initializer_list<value_type> il) : v_(il) {}
-#endif
 
-  ScopedVector& operator=(RValue rhs) {
-    swap(*rhs.object);
+  ScopedVector& operator=(ScopedVector&& rhs) {
+    if (this != &rhs) {
+      clear();
+      swap(rhs);

Review Comment:
   Good catch. I'll keep the source ownership in a temporary before clearing 
the destination for both `scoped_ptr` and `ScopedVector`, and add nested-source 
regression tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to