Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -922,6 +922,18 @@ #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF #endif +#if !__has_builtin(__builtin_memcpy) +#define _LIBCPP_HAS_NO_BUILTIN_MEMCPY +#endif + +#if !__has_builtin(__builtin_strlen) +#define _LIBCPP_HAS_NO_BUILTIN_STRLEN +#endif + +#if !__has_builtin(__builtin_memchr) +#define _LIBCPP_HAS_NO_BUILTIN_MEMCHR +#endif + #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) #if defined(_WIN32) || defined(_NEWLIB_VERSION) #define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS Index: include/__string =================================================================== --- include/__string +++ include/__string @@ -77,17 +77,20 @@ typedef streampos pos_type; typedef mbstate_t state_type; - static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT - {__c1 = __c2;} + static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 void + assign(char_type& __c1, const char_type& __c2) _NOEXCEPT { + __c1 = __c2; + } static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 == __c2;} static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 < __c2;} + _LIBCPP_CONSTEXPR_AFTER_CXX14 static int compare(const char_type* __s1, const char_type* __s2, size_t __n); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 static size_t length(const char_type* __s); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 static const char_type* find(const char_type* __s, size_t __n, const char_type& __a); static char_type* move(char_type* __s1, const char_type* __s2, size_t __n); _LIBCPP_INLINE_VISIBILITY @@ -108,7 +111,7 @@ }; template -int +_LIBCPP_CONSTEXPR_AFTER_CXX14 int char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) { for (; __n; --__n, ++__s1, ++__s2) @@ -122,8 +125,7 @@ } template -inline -size_t +inline _LIBCPP_CONSTEXPR_AFTER_CXX14 size_t char_traits<_CharT>::length(const char_type* __s) { size_t __len = 0; @@ -133,8 +135,7 @@ } template -inline -const _CharT* +inline _LIBCPP_CONSTEXPR_AFTER_CXX14 const _CharT* char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) { for (; __n; --__n) @@ -200,18 +201,85 @@ typedef streampos pos_type; typedef mbstate_t state_type; - static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT - {__c1 = __c2;} + static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 + void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT { + __c1 = __c2; + } static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 == __c2;} 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) _NOEXCEPT - {return __n == 0 ? 0 : memcmp(__s1, __s2, __n);} - 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);} +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) + static inline constexpr int + compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { +#if !defined(_LIBCPP_HAS_NO_BUILTIN_MEMCPY) + return __n == 0 ? 0 : __builtin_memcmp(__s1, __s2, __n); +#else // _LIBCPP_HAS_NO_BUILTIN_MEMCPY + for (; __n; --__n, ++__s1, ++__s2) { + if (lt(*__s1, *__s2)) return -1; + if (lt(*__s2, *__s1)) return 1; + } + return 0; +#endif // _LIBCPP_HAS_NO_BUILTIN_MEMCPY +#else // _LIBCPP_STD_VER > 14 ... + static inline int + compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + return __n == 0 ? 0 : +#if !defined(_LIBCPP_HAS_NO_BUILTIN_MEMCPY) + __builtin_memcmp(__s1, __s2, __n); +#else // _LIBCPP_HAS_NO_BUILTIN_MEMCPY + memcmp(__s1, __s2, __n); +#endif // _LIBCPP_HAS_NO_BUILTIN_MEMCPY +#endif // _LIBCPP_STD_VER > 14 ... + } + +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) + static inline constexpr size_t length(const char_type* __s) _NOEXCEPT { +#if !defined(_LIBCPP_HAS_NO_BUILTIN_STRLEN) + return __builtin_strlen(__s); +#else // _LIBCPP_HAS_NO_BUILTIN_STRLEN + size_t __len = 0; + for (; !eq(*__s, char_type(0)); ++__s) ++__len; + return __len; +#endif // _LIBCPP_HAS_NO_BUILTIN_STRLEN +#else // _LIBCPP_STD_VER > 14 ... + static inline size_t length(const char_type* __s) _NOEXCEPT { + return +#if !defined(_LIBCPP_HAS_NO_BUILTIN_STRLEN) + __builtin_strlen(__s); +#else // _LIBCPP_HAS_NO_BUILTIN_STRLEN + strlen(__s); +#endif // _LIBCPP_HAS_NO_BUILTIN_STRLEN +#endif // _LIBCPP_STD_VER > 14 ... + } + +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) + static inline constexpr const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT { + // we can't use __builtin_memchr here, + // because cast from void* is not allowed + // in constexpr functions + // TODO: find more appropriate solution + for (; __n; --__n) { + if (eq(*__s, __a)) + return __s; + ++__s; + } + return 0; +#else // _LIBCPP_STD_VER > 14 ... + static inline const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT { + return __n == 0 ? NULL + : +#if !defined(_LIBCPP_HAS_NO_BUILTIN_MEMCHR) + (const char_type*) __builtin_memchr(__s, to_int_type(__a), __n); +#else // _LIBCPP_HAS_NO_BUILTIN_MEMCHR + (const char_type*) memchr(__s, to_int_type(__a), __n); +#endif // _LIBCPP_HAS_NO_BUILTIN_MEMCHR +#endif // _LIBCPP_STD_VER > 14 ... + } + 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) _NOEXCEPT Index: test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign2.pass.cpp =================================================================== --- test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign2.pass.cpp +++ test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign2.pass.cpp @@ -16,9 +16,23 @@ #include #include +#include "test_macros.h" + +#if TEST_STD_VER > 14 +constexpr char check_constexpr() { + char c = '\0'; + std::char_traits::assign(c, 'b'); + return c; +} +#endif + int main() { char c = '\0'; std::char_traits::assign(c, 'a'); assert(c == 'a'); + +#if TEST_STD_VER > 14 + static_assert(check_constexpr() == 'b', ""); +#endif } Index: test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/compare.pass.cpp =================================================================== --- test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/compare.pass.cpp +++ test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/compare.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "test_macros.h" + int main() { assert(std::char_traits::compare("", "", 0) == 0); @@ -38,4 +40,27 @@ assert(std::char_traits::compare("223", "123", 3) > 0); assert(std::char_traits::compare("133", "123", 3) > 0); assert(std::char_traits::compare("124", "123", 3) > 0); + +#if TEST_STD_VER > 14 + static_assert(std::char_traits::compare("", "", 0) == 0); + static_assert(std::char_traits::compare(NULL, NULL, 0) == 0); + + static_assert(std::char_traits::compare("1", "1", 1) == 0); + static_assert(std::char_traits::compare("1", "2", 1) < 0); + static_assert(std::char_traits::compare("2", "1", 1) > 0); + + static_assert(std::char_traits::compare("12", "12", 2) == 0); + static_assert(std::char_traits::compare("12", "13", 2) < 0); + static_assert(std::char_traits::compare("12", "22", 2) < 0); + static_assert(std::char_traits::compare("13", "12", 2) > 0); + static_assert(std::char_traits::compare("22", "12", 2) > 0); + + static_assert(std::char_traits::compare("123", "123", 3) == 0); + static_assert(std::char_traits::compare("123", "223", 3) < 0); + static_assert(std::char_traits::compare("123", "133", 3) < 0); + static_assert(std::char_traits::compare("123", "124", 3) < 0); + static_assert(std::char_traits::compare("223", "123", 3) > 0); + static_assert(std::char_traits::compare("133", "123", 3) > 0); + static_assert(std::char_traits::compare("124", "123", 3) > 0); +#endif } Index: test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/find.pass.cpp =================================================================== --- test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/find.pass.cpp +++ test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/find.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "test_macros.h" + int main() { char s1[] = {1, 2, 3}; @@ -25,4 +27,16 @@ assert(std::char_traits::find(s1, 3, char(4)) == 0); assert(std::char_traits::find(s1, 3, char(0)) == 0); assert(std::char_traits::find(NULL, 0, char(0)) == 0); + +#if TEST_STD_VER > 14 + { + constexpr char s1[] = {1, 2, 3}; + static_assert(std::char_traits::find(s1, 3, char(1)) == s1); + static_assert(std::char_traits::find(s1, 3, char(2)) == s1+1); + static_assert(std::char_traits::find(s1, 3, char(3)) == s1+2); + static_assert(std::char_traits::find(s1, 3, char(4)) == 0); + static_assert(std::char_traits::find(s1, 3, char(0)) == 0); + static_assert(std::char_traits::find(NULL, 0, char(0)) == 0); + } +#endif } Index: test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/length.pass.cpp =================================================================== --- test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/length.pass.cpp +++ test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/length.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "test_macros.h" + int main() { assert(std::char_traits::length("") == 0); @@ -23,4 +25,12 @@ assert(std::char_traits::length("aa") == 2); assert(std::char_traits::length("aaa") == 3); assert(std::char_traits::length("aaaa") == 4); + +#if TEST_STD_VER > 14 + static_assert(std::char_traits::length("") == 0); + static_assert(std::char_traits::length("a") == 1); + static_assert(std::char_traits::length("aa") == 2); + static_assert(std::char_traits::length("aaa") == 3); + static_assert(std::char_traits::length("aaaa") == 4); +#endif } Index: test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp +++ test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp @@ -66,4 +66,21 @@ static_assert (!("abcde0" == sv2), "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + static_assert ( sv1 == "", "" ); + static_assert ( "" == sv1, "" ); + static_assert (!(sv1 == "abcde"), "" ); + static_assert (!("abcde" == sv1), "" ); + + static_assert ( sv2 == "abcde", "" ); + static_assert ( "abcde" == sv2, "" ); + static_assert (!(sv2 == "abcde0"), "" ); + static_assert (!("abcde0" == sv2), "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp +++ test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp @@ -59,4 +59,15 @@ static_assert (!(sv1 == sv3), "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2; + constexpr SV sv3 { "abcde", 5 }; + static_assert ( sv1 == sv2, "" ); + static_assert (!(sv1 == sv3), "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp +++ test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp @@ -69,4 +69,23 @@ static_assert ( "abcde0" >= sv2, "" ); } #endif +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert ( sv1 >= "", "" ); + static_assert ( "" >= sv1, "" ); + static_assert (!(sv1 >= "abcde"), "" ); + static_assert ( "abcde" >= sv1, "" ); + + static_assert ( sv2 >= "", "" ); + static_assert (!("" >= sv2), "" ); + static_assert ( sv2 >= "abcde", "" ); + static_assert ( "abcde" >= sv2, "" ); + static_assert (!(sv2 >= "abcde0"), "" ); + static_assert ( "abcde0" >= sv2, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp +++ test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp @@ -62,4 +62,18 @@ static_assert ( sv2 >= sv1, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert ( sv1 >= sv1, "" ); + static_assert ( sv2 >= sv2, "" ); + + static_assert (!(sv1 >= sv2), "" ); + static_assert ( sv2 >= sv1, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp +++ test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp @@ -69,4 +69,24 @@ static_assert ( "abcde0" > sv2, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (!(sv1 > ""), "" ); + static_assert (!("" > sv1), "" ); + static_assert (!(sv1 > "abcde"), "" ); + static_assert ( "abcde" > sv1, "" ); + + static_assert ( sv2 > "", "" ); + static_assert (!("" > sv2), "" ); + static_assert (!(sv2 > "abcde"), "" ); + static_assert (!("abcde" > sv2), "" ); + static_assert (!(sv2 > "abcde0"), "" ); + static_assert ( "abcde0" > sv2, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp +++ test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp @@ -62,4 +62,18 @@ static_assert ( sv2 > sv1, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (!(sv1 > sv1), "" ); + static_assert (!(sv2 > sv2), "" ); + + static_assert (!(sv1 > sv2), "" ); + static_assert ( sv2 > sv1, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp +++ test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp @@ -69,4 +69,24 @@ static_assert (!("abcde0" <= sv2), "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert ( sv1 <= "", "" ); + static_assert ( "" <= sv1, "" ); + static_assert ( sv1 <= "abcde", "" ); + static_assert (!("abcde" <= sv1), "" ); + + static_assert (!(sv2 <= ""), "" ); + static_assert ( "" <= sv2, "" ); + static_assert ( sv2 <= "abcde", "" ); + static_assert ( "abcde" <= sv2, "" ); + static_assert ( sv2 <= "abcde0", "" ); + static_assert (!("abcde0" <= sv2), "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp +++ test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp @@ -62,4 +62,18 @@ static_assert (!(sv2 <= sv1), "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert ( sv1 <= sv1, "" ); + static_assert ( sv2 <= sv2, "" ); + + static_assert ( sv1 <= sv2, "" ); + static_assert (!(sv2 <= sv1), "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp +++ test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp @@ -69,4 +69,24 @@ static_assert (!("abcde0" < sv2), "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (!(sv1 < ""), "" ); + static_assert (!("" < sv1), "" ); + static_assert ( sv1 < "abcde", "" ); + static_assert (!("abcde" < sv1), "" ); + + static_assert (!(sv2 < ""), "" ); + static_assert ( "" < sv2, "" ); + static_assert (!(sv2 < "abcde"), "" ); + static_assert (!("abcde" < sv2), "" ); + static_assert ( sv2 < "abcde0", "" ); + static_assert (!("abcde0" < sv2), "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp +++ test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp @@ -62,4 +62,18 @@ static_assert (!(sv2 < sv1), "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (!(sv1 < sv1), "" ); + static_assert (!(sv2 < sv2), "" ); + + static_assert ( sv1 < sv2, "" ); + static_assert (!(sv2 < sv1), "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp +++ test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp @@ -67,4 +67,22 @@ static_assert ( "abcde0" != sv2, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (!(sv1 != ""), "" ); + static_assert (!("" != sv1), "" ); + static_assert ( sv1 != "abcde", "" ); + static_assert ( "abcde" != sv1, "" ); + + static_assert (!(sv2 != "abcde"), "" ); + static_assert (!("abcde" != sv2), "" ); + static_assert ( sv2 != "abcde0", "" ); + static_assert ( "abcde0" != sv2, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp +++ test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp @@ -59,4 +59,15 @@ static_assert ( sv1 != sv3, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2; + constexpr SV sv3 { "abcde", 5 }; + static_assert (!( sv1 != sv2), "" ); + static_assert ( sv1 != sv3, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.cons/from_literal.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.cons/from_literal.pass.cpp +++ test/std/strings/string.view/string.view.cons/from_literal.pass.cpp @@ -62,4 +62,11 @@ static_assert ( sv1.size() == 5, ""); } #endif + +#if TEST_STD_VER > 14 + { + constexpr std::string_view sv1 ( "ABCDE" ); + static_assert ( sv1.size() == 5, ""); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_char_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_char_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_char_size.pass.cpp @@ -82,4 +82,20 @@ static_assert (sv2.find( 'c', 4 ) == SV::npos, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find( 'c', 0 ) == SV::npos, "" ); + static_assert (sv1.find( 'c', 1 ) == SV::npos, "" ); + static_assert (sv2.find( 'c', 0 ) == 2, "" ); + static_assert (sv2.find( 'c', 1 ) == 2, "" ); + static_assert (sv2.find( 'c', 2 ) == 2, "" ); + static_assert (sv2.find( 'c', 3 ) == SV::npos, "" ); + static_assert (sv2.find( 'c', 4 ) == SV::npos, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_first_not_of_char_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_first_not_of_char_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_first_not_of_char_size.pass.cpp @@ -82,4 +82,18 @@ static_assert (sv2.find_first_not_of( 'q', 5 ) == SV::npos, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_first_not_of( 'q', 0 ) == SV::npos, "" ); + static_assert (sv1.find_first_not_of( 'q', 1 ) == SV::npos, "" ); + static_assert (sv2.find_first_not_of( 'q', 0 ) == 0, "" ); + static_assert (sv2.find_first_not_of( 'q', 1 ) == 1, "" ); + static_assert (sv2.find_first_not_of( 'q', 5 ) == SV::npos, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp @@ -163,4 +163,18 @@ static_assert (sv2.find_first_not_of( "lecar", 0) == 1, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_first_not_of( "", 0) == SV::npos, "" ); + static_assert (sv1.find_first_not_of( "irkhs", 0) == SV::npos, "" ); + static_assert (sv2.find_first_not_of( "", 0) == 0, "" ); + static_assert (sv2.find_first_not_of( "gfsrt", 0) == 0, "" ); + static_assert (sv2.find_first_not_of( "lecar", 0) == 1, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp @@ -390,4 +390,18 @@ static_assert (sv2.find_first_not_of( "lecar", 0, 5) == 1, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_first_not_of( "", 0, 0) == SV::npos, "" ); + static_assert (sv1.find_first_not_of( "irkhs", 0, 5) == SV::npos, "" ); + static_assert (sv2.find_first_not_of( "", 0, 0) == 0, "" ); + static_assert (sv2.find_first_not_of( "gfsrt", 0, 5) == 0, "" ); + static_assert (sv2.find_first_not_of( "lecar", 0, 5) == 1, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_first_of_char_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_first_of_char_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_first_of_char_size.pass.cpp @@ -80,4 +80,18 @@ static_assert (sv2.find_first_of( 'e', 5 ) == SV::npos, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_first_of( 'e', 0 ) == SV::npos, "" ); + static_assert (sv1.find_first_of( 'e', 1 ) == SV::npos, "" ); + static_assert (sv2.find_first_of( 'q', 0 ) == SV::npos, "" ); + static_assert (sv2.find_first_of( 'e', 1 ) == 4, "" ); + static_assert (sv2.find_first_of( 'e', 5 ) == SV::npos, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_first_of_pointer_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_first_of_pointer_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_first_of_pointer_size.pass.cpp @@ -163,4 +163,18 @@ static_assert (sv2.find_first_of( "lecar", 0) == 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_first_of( "", 0) == SV::npos, "" ); + static_assert (sv1.find_first_of( "irkhs", 0) == SV::npos, "" ); + static_assert (sv2.find_first_of( "", 0) == SV::npos, "" ); + static_assert (sv2.find_first_of( "gfsrt", 0) == SV::npos, "" ); + static_assert (sv2.find_first_of( "lecar", 0) == 0, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp @@ -390,4 +390,18 @@ static_assert (sv2.find_first_of( "lecar", 0, 5) == 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_first_of( "", 0, 0) == SV::npos, "" ); + static_assert (sv1.find_first_of( "irkhs", 0, 5) == SV::npos, "" ); + static_assert (sv2.find_first_of( "", 0, 0) == SV::npos, "" ); + static_assert (sv2.find_first_of( "gfsrt", 0, 5) == SV::npos, "" ); + static_assert (sv2.find_first_of( "lecar", 0, 5) == 0, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp @@ -80,4 +80,18 @@ static_assert (sv2.find_last_not_of( 'e', 5 ) == 3, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_last_not_of( 'i', 0 ) == SV::npos, "" ); + static_assert (sv1.find_last_not_of( 'i', 1 ) == SV::npos, "" ); + static_assert (sv2.find_last_not_of( 'a', 0 ) == SV::npos, "" ); + static_assert (sv2.find_last_not_of( 'a', 1 ) == 1, "" ); + static_assert (sv2.find_last_not_of( 'e', 5 ) == 3, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp @@ -163,4 +163,18 @@ static_assert (sv2.find_last_not_of( "lecar", 5) == 3, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_last_not_of( "", 0) == SV::npos, "" ); + static_assert (sv1.find_last_not_of( "irkhs", 5) == SV::npos, "" ); + static_assert (sv2.find_last_not_of( "", 0) == 0, "" ); + static_assert (sv2.find_last_not_of( "gfsrt", 5) == 4, "" ); + static_assert (sv2.find_last_not_of( "lecar", 5) == 3, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp @@ -390,4 +390,18 @@ static_assert (sv2.find_last_not_of( "lecar", 5, 0) == 4, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_last_not_of( "", 0, 0) == SV::npos, "" ); + static_assert (sv1.find_last_not_of( "irkhs", 0, 5) == SV::npos, "" ); + static_assert (sv2.find_last_not_of( "", 0, 0) == 0, "" ); + static_assert (sv2.find_last_not_of( "gfsrt", 5, 0) == 4, "" ); + static_assert (sv2.find_last_not_of( "lecar", 5, 0) == 4, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_last_of_char_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_last_of_char_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_last_of_char_size.pass.cpp @@ -80,4 +80,18 @@ static_assert (sv2.find_last_of( 'e', 5 ) == 4, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_last_of( 'i', 0 ) == SV::npos, "" ); + static_assert (sv1.find_last_of( 'i', 1 ) == SV::npos, "" ); + static_assert (sv2.find_last_of( 'a', 0 ) == 0, "" ); + static_assert (sv2.find_last_of( 'a', 1 ) == 0, "" ); + static_assert (sv2.find_last_of( 'e', 5 ) == 4, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_last_of_pointer_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_last_of_pointer_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_last_of_pointer_size.pass.cpp @@ -163,4 +163,18 @@ static_assert (sv2.find_last_of( "lecar", 5) == 4, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_last_of( "", 0) == SV::npos, "" ); + static_assert (sv1.find_last_of( "irkhs", 5) == SV::npos, "" ); + static_assert (sv2.find_last_of( "", 0) == SV::npos, "" ); + static_assert (sv2.find_last_of( "gfsrt", 5) == SV::npos, "" ); + static_assert (sv2.find_last_of( "lecar", 5) == 4, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp @@ -390,4 +390,18 @@ static_assert (sv2.find_last_of( "lecar", 5, 5) == 4, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find_last_of( "", 0, 0) == SV::npos, "" ); + static_assert (sv1.find_last_of( "irkhs", 0, 5) == SV::npos, "" ); + static_assert (sv2.find_last_of( "", 0, 0) == SV::npos, "" ); + static_assert (sv2.find_last_of( "gfsrt", 5, 5) == SV::npos, "" ); + static_assert (sv2.find_last_of( "lecar", 5, 5) == 4, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_pointer_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_pointer_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_pointer_size.pass.cpp @@ -169,4 +169,18 @@ static_assert (sv2.find( "abcde", 1) == SV::npos, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find( "") == 0, "" ); + static_assert (sv1.find( "abcde") == SV::npos, "" ); + static_assert (sv2.find( "") == 0, "" ); + static_assert (sv2.find( "abcde") == 0, "" ); + static_assert (sv2.find( "abcde", 1) == SV::npos, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_pointer_size_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_pointer_size_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_pointer_size_size.pass.cpp @@ -391,4 +391,19 @@ static_assert (sv2.find( "abcde", 0, 1 ) == 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find( "", 0, 0 ) == 0, "" ); + static_assert (sv1.find( "abcde", 0, 0 ) == 0, "" ); + static_assert (sv1.find( "abcde", 0, 1 ) == SV::npos, "" ); + static_assert (sv2.find( "", 0, 0 ) == 0, "" ); + static_assert (sv2.find( "abcde", 0, 0 ) == 0, "" ); + static_assert (sv2.find( "abcde", 0, 1 ) == 0, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/find_string_view_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/find_string_view_size.pass.cpp +++ test/std/strings/string.view/string.view.find/find_string_view_size.pass.cpp @@ -162,4 +162,18 @@ static_assert (sv2.find(sv2, 1 ) == SV::npos, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.find(sv1) == 0, "" ); + static_assert (sv1.find(sv2) == SV::npos, "" ); + static_assert (sv2.find(sv1) == 0, "" ); + static_assert (sv2.find(sv2) == 0, "" ); + static_assert (sv2.find(sv2, 1 ) == SV::npos, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/rfind_char_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/rfind_char_size.pass.cpp +++ test/std/strings/string.view/string.view.find/rfind_char_size.pass.cpp @@ -81,4 +81,20 @@ static_assert (sv2.rfind( 'b', 4 ) == 1, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.rfind( 'b', 0 ) == SV::npos, "" ); + static_assert (sv1.rfind( 'b', 1 ) == SV::npos, "" ); + static_assert (sv2.rfind( 'b', 0 ) == SV::npos, "" ); + static_assert (sv2.rfind( 'b', 1 ) == 1, "" ); + static_assert (sv2.rfind( 'b', 2 ) == 1, "" ); + static_assert (sv2.rfind( 'b', 3 ) == 1, "" ); + static_assert (sv2.rfind( 'b', 4 ) == 1, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/rfind_pointer_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/rfind_pointer_size.pass.cpp +++ test/std/strings/string.view/string.view.find/rfind_pointer_size.pass.cpp @@ -169,4 +169,18 @@ static_assert (sv2.rfind( "abcde", 1) == 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.rfind( "") == 0, "" ); + static_assert (sv1.rfind( "abcde") == SV::npos, "" ); + static_assert (sv2.rfind( "") == 5, "" ); + static_assert (sv2.rfind( "abcde") == 0, "" ); + static_assert (sv2.rfind( "abcde", 1) == 0, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/rfind_pointer_size_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/rfind_pointer_size_size.pass.cpp +++ test/std/strings/string.view/string.view.find/rfind_pointer_size_size.pass.cpp @@ -390,4 +390,19 @@ static_assert (sv2.rfind( "abcde", 0, 1 ) == 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.rfind( "", 0, 0 ) == 0, "" ); + static_assert (sv1.rfind( "abcde", 0, 0 ) == 0, "" ); + static_assert (sv1.rfind( "abcde", 0, 1 ) == SV::npos, "" ); + static_assert (sv2.rfind( "", 0, 0 ) == 0, "" ); + static_assert (sv2.rfind( "abcde", 0, 0 ) == 0, "" ); + static_assert (sv2.rfind( "abcde", 0, 1 ) == 0, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.find/rfind_string_view_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.find/rfind_string_view_size.pass.cpp +++ test/std/strings/string.view/string.view.find/rfind_string_view_size.pass.cpp @@ -162,4 +162,18 @@ static_assert (sv2.rfind(sv2, 1) == 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + + static_assert (sv1.rfind(sv1) == 0, "" ); + static_assert (sv1.rfind(sv2) == SV::npos, "" ); + static_assert (sv2.rfind(sv1) == 5, "" ); + static_assert (sv2.rfind(sv2) == 0, "" ); + static_assert (sv2.rfind(sv2, 1) == 0, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp +++ test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp @@ -124,4 +124,16 @@ static_assert ( sv2.compare("abcde") == 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + static_assert ( sv1.compare("") == 0, "" ); + static_assert ( sv1.compare("abcde") == -1, "" ); + static_assert ( sv2.compare("") == 1, "" ); + static_assert ( sv2.compare("abcde") == 0, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp +++ test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp @@ -449,4 +449,16 @@ static_assert ( sv2.compare(0, 6, "abcde") == 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcde", 5 }; + static_assert ( sv1.compare(0, 0, "") == 0, "" ); + static_assert ( sv1.compare(0, 0, "abcde") == -1, "" ); + static_assert ( sv2.compare(0, 2, "") == 1, "" ); + static_assert ( sv2.compare(0, 6, "abcde") == 0, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp +++ test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp @@ -398,4 +398,14 @@ static_assert ( sv1.compare(2, 4, sv2) == 1, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1 { "abcde", 5 }; + constexpr SV sv2 { "abcde", 0 }; + static_assert ( sv1.compare(5, 1, sv2) == 0, "" ); + static_assert ( sv1.compare(2, 4, sv2) == 1, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp +++ test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp @@ -1349,4 +1349,15 @@ static_assert ( sv2.compare(0, 0, "abcde", 1, 0) == 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1; + constexpr SV sv2 { "abcdefghijklmnopqrst", 21 }; + static_assert ( sv1.compare(0, 0, "abcde", 0) == 0, "" ); + static_assert ( sv1.compare(0, 0, "abcde", 1) == -1, "" ); + static_assert ( sv2.compare(0, 0, "abcde", 1, 0) == 0, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp +++ test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp @@ -5844,4 +5844,14 @@ static_assert ( sv1.compare(2, 4, "abcde", 3, 4) == -1, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1 { "abcde", 5 }; + static_assert ( sv1.compare(5, 1, "", 0, 0) == 0, "" ); + static_assert ( sv1.compare(2, 4, "", 0, 0) == 1, "" ); + static_assert ( sv1.compare(2, 4, "abcde", 3, 4) == -1, "" ); + } +#endif } Index: test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp +++ test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp @@ -119,4 +119,17 @@ static_assert ( sv2.compare(sv3) < 0, "" ); } #endif + +#if TEST_STD_VER > 14 + { + typedef std::string_view SV; + constexpr SV sv1 { "abcde", 5 }; + constexpr SV sv2 { "abcde", 5 }; + constexpr SV sv3 { "edcba0", 6 }; + static_assert ( sv1.compare(sv2) == 0, "" ); + static_assert ( sv2.compare(sv1) == 0, "" ); + static_assert ( sv3.compare(sv2) > 0, "" ); + static_assert ( sv2.compare(sv3) < 0, "" ); + } +#endif }