From 5ec13c0b061d2a31a61fcf86bc821183018c28cb Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 1 Jul 2022 10:45:35 +0200 Subject: [PATCH] util/StringStrip: add libc++ compatibility kludge --- src/util/StringStrip.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util/StringStrip.cxx b/src/util/StringStrip.cxx index 9ad65cee0..388ab336a 100644 --- a/src/util/StringStrip.cxx +++ b/src/util/StringStrip.cxx @@ -57,10 +57,15 @@ StripLeft(const std::string_view s) noexcept auto i = std::find_if_not(s.begin(), s.end(), [](auto ch){ return IsWhitespaceOrNull(ch); }); +#ifdef __clang__ + // libc++ doesn't yet support the C++20 constructor + return s.substr(std::distance(s.begin(), i)); +#else return { i, s.end(), }; +#endif } const char *