chenBright commented on code in PR #3685:
URL: https://github.com/apache/brpc/pull/3685#discussion_r4467339401
##########
src/butil/files/file.h:
##########
@@ -167,13 +164,14 @@ class BUTIL_EXPORT File {
// Creates an object with a specific error_details code.
explicit File(Error error_details);
- // Move constructor for C++03 move emulation of this type.
- File(RValue other);
+ File(const File&) = delete;
+ File& operator=(const File&) = delete;
Review Comment:
Please use `DISALLOW_COPY_AND_ASSIGN` instead.
##########
src/butil/memory/scoped_ptr.h:
##########
@@ -326,37 +299,35 @@ class scoped_ptr {
// Constructor. Allows initialization of a stateful deleter.
scoped_ptr(element_type* p, const D& d) : impl_(p, d) { }
- // Constructor. Allows construction from a scoped_ptr rvalue for a
- // convertible type and deleter.
- //
- // IMPLEMENTATION NOTE: C++11 unique_ptr<> keeps this constructor distinct
- // from the normal move constructor. By C++11 20.7.1.2.1.21, this constructor
- // has different post-conditions if D is a reference type. Since this
- // implementation does not support deleters with reference type,
- // we do not need a separate move constructor allowing us to avoid one
- // use of SFINAE. You only need to care about this if you modify the
- // implementation of scoped_ptr.
- template <typename U, typename V>
- scoped_ptr(scoped_ptr<U, V> other) : impl_(&other.impl_) {
- COMPILE_ASSERT(!butil::is_array<U>::value, U_cannot_be_an_array);
- }
+ scoped_ptr(const scoped_ptr&) = delete;
+ scoped_ptr& operator=(const scoped_ptr&) = delete;
Review Comment:
Please use `DISALLOW_COPY_AND_ASSIGN` instead.
##########
src/butil/memory/scoped_vector.h:
##########
@@ -37,13 +35,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;
Review Comment:
Please use `DISALLOW_COPY_AND_ASSIGN` instead.
##########
src/butil/memory/scoped_ptr.h:
##########
@@ -472,12 +430,15 @@ class scoped_ptr<T[], D> {
// NOT use implicit_cast<Base*>() to upcast the static type of the array.
explicit scoped_ptr(element_type* array) : impl_(array) { }
- // Constructor. Move constructor for C++03 move emulation of this type.
- scoped_ptr(RValue rvalue) : impl_(&rvalue.object->impl_) { }
+ scoped_ptr(const scoped_ptr&) = delete;
+ scoped_ptr& operator=(const scoped_ptr&) = delete;
Review Comment:
Please use `DISALLOW_COPY_AND_ASSIGN` instead.
##########
src/butil/scoped_generic.h:
##########
@@ -84,11 +82,15 @@ class ScopedGeneric {
: data_(value, traits) {
}
- // Move constructor for C++03 move emulation.
- ScopedGeneric(RValue rvalue)
- : data_(rvalue.object->release(), rvalue.object->get_traits()) {
+ ScopedGeneric(const ScopedGeneric&) = delete;
+ ScopedGeneric& operator=(const ScopedGeneric&) = delete;
Review Comment:
Please use `DISALLOW_COPY_AND_ASSIGN` instead.
--
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]