Explorar o código

source: Pass cmCTestResourceAllocator::Resource by value

Daniel Pfeifer hai 6 meses
pai
achega
964e992ec5

+ 0 - 12
Source/CTest/cmCTestResourceAllocator.cxx

@@ -72,15 +72,3 @@ bool cmCTestResourceAllocator::DeallocateResource(std::string const& name,
   resIt->second.Locked -= slots;
   return true;
 }
-
-bool cmCTestResourceAllocator::Resource::operator==(
-  Resource const& other) const
-{
-  return this->Total == other.Total && this->Locked == other.Locked;
-}
-
-bool cmCTestResourceAllocator::Resource::operator!=(
-  Resource const& other) const
-{
-  return !(*this == other);
-}

+ 9 - 2
Source/CTest/cmCTestResourceAllocator.h

@@ -17,8 +17,15 @@ public:
 
     unsigned int Free() const { return this->Total - this->Locked; }
 
-    bool operator==(Resource const& other) const;
-    bool operator!=(Resource const& other) const;
+    friend bool operator==(Resource left, Resource right)
+    {
+      return left.Total == right.Total && left.Locked == right.Locked;
+    }
+
+    friend bool operator!=(Resource left, Resource right)
+    {
+      return !(left == right);
+    }
   };
 
   void InitializeFromResourceSpec(cmCTestResourceSpec const& spec);