aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/include/std/string_view5
1 files changed, 4 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index a7c5a12..740aa93 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -385,7 +385,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
[[nodiscard]]
constexpr bool
starts_with(basic_string_view __x) const noexcept
- { return this->substr(0, __x.size()) == __x; }
+ {
+ return _M_len >= __x._M_len
+ && traits_type::compare(_M_str, __x._M_str, __x._M_len) == 0;
+ }
[[nodiscard]]
constexpr bool