Loading libcxx/include/__string/char_traits.h +23 −28 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <__iterator/iterator_traits.h> #include <__string/constexpr_c_functions.h> #include <__type_traits/is_constant_evaluated.h> #include <__utility/is_pointer_in_range.h> #include <cstddef> #include <cstdint> #include <cstdio> Loading Loading @@ -142,10 +143,8 @@ struct _LIBCPP_DEPRECATED_("char_traits<T> for T not equal to char, wchar_t, cha _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { if (!__libcpp_is_constant_evaluated()) { _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1 + __n, "char_traits::copy overlapped range"); } _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); char_type* __r = __s1; for (; __n; --__n, ++__s1, ++__s2) assign(*__s1, *__s2); Loading Loading @@ -238,9 +237,8 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1 + __n, "char_traits::copy overlapped range"); _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); std::copy_n(__s2, __n, __s1); return __s1; } Loading Loading @@ -310,9 +308,8 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1 + __n, "char_traits::copy overlapped range"); _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); std::copy_n(__s2, __n, __s1); return __s1; } Loading Loading @@ -375,9 +372,8 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); std::copy_n(__s2, __n, __s1); return __s1; } Loading Loading @@ -460,9 +456,8 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); std::copy_n(__s2, __n, __s1); return __s1; } Loading Loading
libcxx/include/__string/char_traits.h +23 −28 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <__iterator/iterator_traits.h> #include <__string/constexpr_c_functions.h> #include <__type_traits/is_constant_evaluated.h> #include <__utility/is_pointer_in_range.h> #include <cstddef> #include <cstdint> #include <cstdio> Loading Loading @@ -142,10 +143,8 @@ struct _LIBCPP_DEPRECATED_("char_traits<T> for T not equal to char, wchar_t, cha _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { if (!__libcpp_is_constant_evaluated()) { _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1 + __n, "char_traits::copy overlapped range"); } _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); char_type* __r = __s1; for (; __n; --__n, ++__s1, ++__s2) assign(*__s1, *__s2); Loading Loading @@ -238,9 +237,8 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1 + __n, "char_traits::copy overlapped range"); _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); std::copy_n(__s2, __n, __s1); return __s1; } Loading Loading @@ -310,9 +308,8 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1 + __n, "char_traits::copy overlapped range"); _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); std::copy_n(__s2, __n, __s1); return __s1; } Loading Loading @@ -375,9 +372,8 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); std::copy_n(__s2, __n, __s1); return __s1; } Loading Loading @@ -460,9 +456,8 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES( __s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2), "char_traits::copy: source and destination ranges overlap"); std::copy_n(__s2, __n, __s1); return __s1; } Loading