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


##########
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);
+    }
     return *this;
   }

Review Comment:
   Move assignment calls clear(), which deletes the owned objects and may 
propagate exceptions from a destructor declared noexcept(false). Adding 
unconditional noexcept would change that behavior to termination, so I’d keep 
the current exception specification in this PR.
   



-- 
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