You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::string_view checks that the input length is less than PTRDIFF_MAX, which is useful for caching accidental negative numbers getting in there.
But the cost is that the various methods of string_view trigger this check too, because the compiler doesn't know that sv.size() <= PTRDIFF_MAX. See this godbolt: https://godbolt.org/z/zsG4rbTdb
We could fix this with some assumes, but Clang cannot do this analysis anyway (see #91619). So I think probably the simplest option is to add a private ctor, string_view(ptr, len, __assume_valid) and make the internal calls use that one.