Index: include/__string =================================================================== --- include/__string +++ include/__string @@ -213,8 +213,7 @@ static _LIBCPP_CONSTEXPR_AFTER_CXX14 int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - static inline size_t _LIBCPP_CONSTEXPR_AFTER_CXX14 - length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);} + size_t length(const char_type* __s) _NOEXCEPT; static _LIBCPP_CONSTEXPR_AFTER_CXX14 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT @@ -262,6 +261,22 @@ } inline _LIBCPP_CONSTEXPR_AFTER_CXX14 +size_t +char_traits::length(const char_type* __s) _NOEXCEPT +{ +#if __has_feature(cxx_constexpr_string_builtins) + return __builtin_strlen(__s); +#elif _LIBCPP_STD_VER <= 14 + return strlen(__s); +#else + size_t __len = 0; + for (; !eq(*__s, char_type(0)); ++__s) + ++__len; + return __len; +#endif +} + +inline _LIBCPP_CONSTEXPR_AFTER_CXX14 const char* char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {