Replace is_sorted with comparison (#1104)

* Replace is_sorted with comparison

* Switch to StringRefContainsPointer
This commit is contained in:
Jon Meow
2022-03-03 10:21:38 -08:00
committed by GitHub
parent 0a8c0dc271
commit c4c5cdc1f5
5 changed files with 17 additions and 4 deletions
+6 -1
View File
@@ -13,7 +13,7 @@
namespace Carbon {
static constexpr llvm::StringRef TripleQuotes = "\"\"\"";
static constexpr llvm::StringRef TripleQuotes = R"(""")";
static constexpr llvm::StringRef HorizontalWhitespaceChars = " \t";
// Carbon only takes uppercase hex input.
@@ -169,4 +169,9 @@ auto ParseBlockStringLiteral(llvm::StringRef source)
return parsed;
}
auto StringRefContainsPointer(llvm::StringRef ref, const char* ptr) -> bool {
auto le = std::less_equal<const char*>();
return le(ref.begin(), ptr) && le(ptr, ref.end());
}
} // namespace Carbon