summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorborman <[email protected]>2025-10-27 12:54:04 +0300
committerborman <[email protected]>2025-10-27 13:44:56 +0300
commit058dc84c54b72daf9e25b9ae090a80ed843d4cd0 (patch)
treea1be5260ba66af022cbefe17e84ea1e386e2be8f /util
parent0d689db7ec31fdcabf97c3c5b3375253233a55c9 (diff)
Avoid constructing ill-formed `std::basic_string_view<const char>`
Since libc++19, only `std::char_traits<char>` is defined: https://github.com/llvm/llvm-project/commit/e30a148b098d462d0267c479cd9e4783363c2761 This makes usage of `std::char_traits<const char>`, `std::char_traits<unsigned char>`, etc invalid. C++20 deduction guides are now used to infer proper `Char` type; while also avoiding being overly specific with `type_traits`. commit_hash:c5ffaef9ef1c8b462d2fdf0e080a43d5cd4c4ca7
Diffstat (limited to 'util')
-rw-r--r--util/string/split.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/util/string/split.h b/util/string/split.h
index 8e8e01cb4f7..95d345c7fc5 100644
--- a/util/string/split.h
+++ b/util/string/split.h
@@ -84,11 +84,11 @@ static inline I1* FastStrChr(I1* str, I2 f) noexcept {
template <class I>
static inline I* FastStrStr(I* str, I* f, size_t l) noexcept {
- std::basic_string_view<I> strView(str);
+ auto strView = std::basic_string_view(str);
const auto ret = strView.find(*f);
if (ret != std::string::npos) {
- std::basic_string_view<I> fView(f, l);
+ auto fView = std::basic_string_view(f, l);
strView = strView.substr(ret);
for (; strView.size() >= l; strView = strView.substr(1)) {
if (strView.substr(0, l) == fView) {
@@ -117,7 +117,7 @@ struct TStringDelimiter {
}
inline Char* Find(Char*& b, Char* e) const noexcept {
- const auto ret = std::basic_string_view<Char>(b, e - b).find(Delim, 0, Len);
+ const auto ret = std::basic_string_view(b, e - b).find(Delim, 0, Len);
if (ret != std::string::npos) {
const auto result = b + ret;
@@ -148,7 +148,7 @@ struct TCharDelimiter {
}
inline Char* Find(Char*& b, Char* e) const noexcept {
- const auto ret = std::basic_string_view<Char>(b, e - b).find(Ch);
+ const auto ret = std::basic_string_view(b, e - b).find(Ch);
if (ret != std::string::npos) {
const auto result = b + ret;
@@ -213,7 +213,7 @@ struct TFindFirstOf {
}
inline Char* FindFirstOf(Char* b) const noexcept {
- const std::basic_string_view<Char> bView(b);
+ const auto bView = std::basic_string_view(b);
const auto ret = bView.find_first_of(Set);
return ret != std::string::npos ? b + ret : b + bView.size();
}