Переглянути джерело

cmExpandedCommandArgument: add an overload for const char*

Static string comparisons were causing heap allocations just for a
comparison.
Ben Boeckel 7 роки тому
батько
коміт
901c4a1e05

+ 5 - 0
Source/cmExpandedCommandArgument.cxx

@@ -24,6 +24,11 @@ bool cmExpandedCommandArgument::WasQuoted() const
   return this->Quoted;
 }
 
+bool cmExpandedCommandArgument::operator==(const char* value) const
+{
+  return this->Value == value;
+}
+
 bool cmExpandedCommandArgument::operator==(std::string const& value) const
 {
   return this->Value == value;

+ 1 - 0
Source/cmExpandedCommandArgument.h

@@ -24,6 +24,7 @@ public:
 
   bool WasQuoted() const;
 
+  bool operator==(const char* value) const;
   bool operator==(std::string const& value) const;
 
   bool empty() const;