Browse Source

cmGeneratorExpression: Change Find() parameter type to cm::string_view

Craig Scott 1 year ago
parent
commit
5a8a6dfe81
2 changed files with 7 additions and 6 deletions
  1. 6 5
      Source/cmGeneratorExpression.cxx
  2. 1 1
      Source/cmGeneratorExpression.h

+ 6 - 5
Source/cmGeneratorExpression.cxx

@@ -375,14 +375,15 @@ std::string cmGeneratorExpression::Preprocess(const std::string& input,
   return std::string();
 }
 
-std::string::size_type cmGeneratorExpression::Find(const std::string& input)
+cm::string_view::size_type cmGeneratorExpression::Find(
+  const cm::string_view& input)
 {
-  const std::string::size_type openpos = input.find("$<");
-  if (openpos != std::string::npos &&
-      input.find('>', openpos) != std::string::npos) {
+  const cm::string_view::size_type openpos = input.find("$<");
+  if (openpos != cm::string_view::npos &&
+      input.find('>', openpos) != cm::string_view::npos) {
     return openpos;
   }
-  return std::string::npos;
+  return cm::string_view::npos;
 }
 
 bool cmGeneratorExpression::IsValidTargetName(const std::string& input)

+ 1 - 1
Source/cmGeneratorExpression.h

@@ -66,7 +66,7 @@ public:
   static void Split(const std::string& input,
                     std::vector<std::string>& output);
 
-  static std::string::size_type Find(const std::string& input);
+  static cm::string_view::size_type Find(const cm::string_view& input);
 
   static bool IsValidTargetName(const std::string& input);