diff --git a/include/__string b/include/__string index 334541102..764ee56a8 100644 --- a/include/__string +++ b/include/__string @@ -207,19 +207,19 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {return (unsigned char)__c1 < (unsigned char)__c2;} - static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n) + static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {return __n == 0 ? 0 : memcmp(__s1, __s2, __n);} - static inline size_t length(const char_type* __s) {return strlen(__s);} - static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a) + static inline size_t length(const char_type* __s) _NOEXCEPT {return strlen(__s);} + static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {return __n == 0 ? NULL : (const char_type*) memchr(__s, to_int_type(__a), __n);} - static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) + static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);} - static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) + static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); } - static inline char_type* assign(char_type* __s, size_t __n, char_type __a) + static inline char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);} static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT @@ -252,20 +252,20 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 < __c2;} - static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n) + static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {return __n == 0 ? 0 : wmemcmp(__s1, __s2, __n);} - static inline size_t length(const char_type* __s) + static inline size_t length(const char_type* __s) _NOEXCEPT {return wcslen(__s);} - static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a) + static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {return __n == 0 ? NULL : (const char_type*)wmemchr(__s, __a, __n);} - static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) + static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);} - static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) + static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n); } - static inline char_type* assign(char_type* __s, size_t __n, char_type __a) + static inline char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);} static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT @@ -299,17 +299,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits {return __c1 < __c2;} _LIBCPP_INLINE_VISIBILITY - static int compare(const char_type* __s1, const char_type* __s2, size_t __n); + static int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static size_t length(const char_type* __s); + static size_t length(const char_type* __s) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static const char_type* find(const char_type* __s, size_t __n, const char_type& __a); + static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static char_type* move(char_type* __s1, const char_type* __s2, size_t __n); + static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); + static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static char_type* assign(char_type* __s, size_t __n, char_type __a); + static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} @@ -325,7 +325,7 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits inline int -char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) +char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { for (; __n; --__n, ++__s1, ++__s2) { @@ -339,7 +339,7 @@ char_traits::compare(const char_type* __s1, const char_type* __s2, siz inline size_t -char_traits::length(const char_type* __s) +char_traits::length(const char_type* __s) _NOEXCEPT { size_t __len = 0; for (; !eq(*__s, char_type(0)); ++__s) @@ -349,7 +349,7 @@ char_traits::length(const char_type* __s) inline const char16_t* -char_traits::find(const char_type* __s, size_t __n, const char_type& __a) +char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT { for (; __n; --__n) { @@ -362,7 +362,7 @@ char_traits::find(const char_type* __s, size_t __n, const char_type& _ inline char16_t* -char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) +char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { char_type* __r = __s1; if (__s1 < __s2) @@ -382,7 +382,7 @@ char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) inline char16_t* -char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) +char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); char_type* __r = __s1; @@ -393,7 +393,7 @@ char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) inline char16_t* -char_traits::assign(char_type* __s, size_t __n, char_type __a) +char_traits::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { char_type* __r = __s; for (; __n; --__n, ++__s) @@ -418,17 +418,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits {return __c1 < __c2;} _LIBCPP_INLINE_VISIBILITY - static int compare(const char_type* __s1, const char_type* __s2, size_t __n); + static int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static size_t length(const char_type* __s); + static size_t length(const char_type* __s) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static const char_type* find(const char_type* __s, size_t __n, const char_type& __a); + static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static char_type* move(char_type* __s1, const char_type* __s2, size_t __n); + static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); + static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - static char_type* assign(char_type* __s, size_t __n, char_type __a); + static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} @@ -444,7 +444,7 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits inline int -char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) +char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { for (; __n; --__n, ++__s1, ++__s2) { @@ -458,7 +458,7 @@ char_traits::compare(const char_type* __s1, const char_type* __s2, siz inline size_t -char_traits::length(const char_type* __s) +char_traits::length(const char_type* __s) _NOEXCEPT { size_t __len = 0; for (; !eq(*__s, char_type(0)); ++__s) @@ -468,7 +468,7 @@ char_traits::length(const char_type* __s) inline const char32_t* -char_traits::find(const char_type* __s, size_t __n, const char_type& __a) +char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT { for (; __n; --__n) { @@ -481,7 +481,7 @@ char_traits::find(const char_type* __s, size_t __n, const char_type& _ inline char32_t* -char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) +char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { char_type* __r = __s1; if (__s1 < __s2) @@ -501,7 +501,7 @@ char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) inline char32_t* -char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) +char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); char_type* __r = __s1; @@ -512,7 +512,7 @@ char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) inline char32_t* -char_traits::assign(char_type* __s, size_t __n, char_type __a) +char_traits::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { char_type* __r = __s; for (; __n; --__n, ++__s) diff --git a/include/string_view b/include/string_view index 08fcfd623..67fc60656 100644 --- a/include/string_view +++ b/include/string_view @@ -356,7 +356,7 @@ public: } _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - int compare(const _CharT* __s) const + int compare(const _CharT* __s) const _NOEXCEPT { return compare(basic_string_view(__s)); }