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

This commit is contained in:
Craig Scott
2024-09-16 11:11:21 +10:00
parent d810374b3d
commit 5a8a6dfe81
2 changed files with 7 additions and 6 deletions

View File

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

View File

@@ -66,7 +66,7 @@ public:
static void Split(const std::string& input, static void Split(const std::string& input,
std::vector<std::string>& output); 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); static bool IsValidTargetName(const std::string& input);