Replace is_sorted with comparison (#1104)

* Replace is_sorted with comparison

* Switch to StringRefContainsPointer
This commit is contained in:
Jon Meow authored and GitHub committed 2022-03-03 10:21:38 -08:00
1 parent 0a8c0dc271
commit c4c5cdc1f5
5 files changed
+17 -4

No files matched your search

+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