aboutsummaryrefslogtreecommitdiffstats
path: root/include/__string
diff options
context:
space:
mode:
Diffstat (limited to 'include/__string')
-rw-r--r--include/__string12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/__string b/include/__string
index a88b976be3c9..b4c8815f72d2 100644
--- a/include/__string
+++ b/include/__string
@@ -351,6 +351,18 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size
#endif
}
+
+template <class _Traits>
+_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT {
+#if _LIBCPP_DEBUG_LEVEL >= 1
+ return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0);
+#else
+ return _Traits::length(__s);
+#endif
+}
+
inline _LIBCPP_CONSTEXPR_AFTER_CXX14
size_t
char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT