Browse Source

Clang-tidy - modernize-use-equals-delete.
Deleted member function should be public.

Yao Wei Tjong 姚伟忠 8 years ago
parent
commit
c2fcc8decb

+ 5 - 5
Source/Urho3D/Container/Allocator.h

@@ -85,6 +85,11 @@ public:
         AllocatorUninitialize(allocator_);
     }
 
+    /// Prevent copy construction.
+    Allocator(const Allocator<T>& rhs) = delete;
+    /// Prevent assignment.
+    Allocator<T>& operator =(const Allocator<T>& rhs) = delete;
+
     /// Reserve and default-construct an object.
     T* Reserve()
     {
@@ -115,11 +120,6 @@ public:
     }
 
 private:
-    /// Prevent copy construction.
-    Allocator(const Allocator<T>& rhs) = delete;
-    /// Prevent assignment.
-    Allocator<T>& operator =(const Allocator<T>& rhs) = delete;
-
     /// Allocator block.
     AllocatorBlock* allocator_;
 };

+ 3 - 5
Source/Urho3D/Container/HashMap.h

@@ -64,9 +64,11 @@ public:
         {
         }
 
+        /// Prevent assignment.
+        KeyValue& operator =(const KeyValue& rhs) = delete;
+
         /// Test for equality with another pair.
         bool operator ==(const KeyValue& rhs) const { return first_ == rhs.first_ && second_ == rhs.second_; }
-
         /// Test for inequality with another pair.
         bool operator !=(const KeyValue& rhs) const { return first_ != rhs.first_ || second_ != rhs.second_; }
 
@@ -74,10 +76,6 @@ public:
         const T first_;
         /// Value.
         U second_;
-
-    private:
-        /// Prevent assignment.
-        KeyValue& operator =(const KeyValue& rhs) = delete;
     };
 
     /// Hash map node.

+ 5 - 4
Source/Urho3D/Container/Ptr.h

@@ -524,10 +524,6 @@ template<class T> inline void CheckedDelete(T* x)
 /// Unique pointer template class.
 template <class T> class UniquePtr
 {
-    // Make non-copyable
-    UniquePtr(const UniquePtr&) = delete;
-    UniquePtr& operator=(const UniquePtr&) = delete;
-
 public:
     /// Construct empty.
     UniquePtr() : ptr_(0) { }
@@ -535,6 +531,11 @@ public:
     /// Construct from pointer.
     explicit UniquePtr(T* ptr) : ptr_(ptr) { }
 
+    /// Prevent copy construction.
+    UniquePtr(const UniquePtr&) = delete;
+    /// Prevent assignment.
+    UniquePtr& operator=(const UniquePtr&) = delete;
+
     /// Assign from pointer.
     UniquePtr& operator = (T* ptr)
     {

+ 10 - 12
Source/Urho3D/Graphics/OctreeQuery.h

@@ -49,6 +49,11 @@ public:
     /// Destruct.
     virtual ~OctreeQuery() = default;
 
+    /// Prevent copy construction.
+    OctreeQuery(const OctreeQuery& rhs) = delete;
+    /// Prevent assignment.
+    OctreeQuery& operator =(const OctreeQuery& rhs) = delete;
+
     /// Intersection test for an octant.
     virtual Intersection TestOctant(const BoundingBox& box, bool inside) = 0;
     /// Intersection test for drawables.
@@ -60,12 +65,6 @@ public:
     unsigned char drawableFlags_;
     /// Drawable layers to include.
     unsigned viewMask_;
-
-private:
-    /// Prevent copy construction.
-    OctreeQuery(const OctreeQuery& rhs) = delete;
-    /// Prevent assignment.
-    OctreeQuery& operator =(const OctreeQuery& rhs) = delete;
 };
 
 /// Point octree query.
@@ -234,6 +233,11 @@ public:
     {
     }
 
+    /// Prevent copy construction.
+    RayOctreeQuery(const RayOctreeQuery& rhs) = delete;
+    /// Prevent assignment.
+    RayOctreeQuery& operator =(const RayOctreeQuery& rhs) = delete;
+
     /// Result vector reference.
     PODVector<RayQueryResult>& result_;
     /// Ray.
@@ -246,12 +250,6 @@ public:
     float maxDistance_;
     /// Raycast detail level.
     RayQueryLevel level_;
-
-private:
-    /// Prevent copy construction.
-    RayOctreeQuery(const RayOctreeQuery& rhs) = delete;
-    /// Prevent assignment.
-    RayOctreeQuery& operator =(const RayOctreeQuery& rhs) = delete;
 };
 
 class URHO3D_API AllContentOctreeQuery : public OctreeQuery