@@ -1912,6 +1912,9 @@ private:
1912
1912
#ifndef _LIBCPP_CXX03_LANG
1913
1913
if constexpr (__libcpp_is_contiguous_iterator<_ForwardIter>::value &&
1914
1914
is_same<value_type, __iter_value_type<_ForwardIter>>::value && is_same<_ForwardIter, _Sent>::value) {
1915
+ _LIBCPP_ASSERT_INTERNAL (
1916
+ !std::__is_overlapping_range (std::__to_address (__first), std::__to_address (__last), __dest),
1917
+ " __copy_non_overlapping_range called with an overlapping range!" );
1915
1918
traits_type::copy (__dest, std::__to_address (__first), __last - __first);
1916
1919
return __dest + (__last - __first);
1917
1920
}
@@ -1966,9 +1969,12 @@ private:
1966
1969
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_size (size_type __s) _NOEXCEPT {
1967
1970
__rep_.__l .__size_ = __s;
1968
1971
}
1972
+
1969
1973
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_size () const _NOEXCEPT {
1974
+ _LIBCPP_ASSERT_INTERNAL (__rep_.__l .__is_long_ , " String has to be long when trying to get the long size" );
1970
1975
return __rep_.__l .__size_ ;
1971
1976
}
1977
+
1972
1978
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_size (size_type __s) _NOEXCEPT {
1973
1979
if (__is_long ())
1974
1980
__set_long_size (__s);
@@ -1977,11 +1983,13 @@ private:
1977
1983
}
1978
1984
1979
1985
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_cap (size_type __s) _NOEXCEPT {
1986
+ _LIBCPP_ASSERT_INTERNAL (!__fits_in_sso (__s), " Long capacity should always be larger than the SSO" );
1980
1987
__rep_.__l .__cap_ = __s / __endian_factor;
1981
1988
__rep_.__l .__is_long_ = true ;
1982
1989
}
1983
1990
1984
1991
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_cap () const _NOEXCEPT {
1992
+ _LIBCPP_ASSERT_INTERNAL (__rep_.__l .__is_long_ , " String has to be long when trying to get the long capacity" );
1985
1993
return __rep_.__l .__cap_ * __endian_factor;
1986
1994
}
1987
1995
@@ -1990,10 +1998,12 @@ private:
1990
1998
}
1991
1999
1992
2000
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_long_pointer () _NOEXCEPT {
2001
+ _LIBCPP_ASSERT_INTERNAL (__rep_.__l .__is_long_ , " String has to be long when trying to get the long pointer" );
1993
2002
return _LIBCPP_ASAN_VOLATILE_WRAPPER (__rep_.__l .__data_ );
1994
2003
}
1995
2004
1996
2005
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_long_pointer () const _NOEXCEPT {
2006
+ _LIBCPP_ASSERT_INTERNAL (__rep_.__l .__is_long_ , " String has to be long when trying to get the long pointer" );
1997
2007
return _LIBCPP_ASAN_VOLATILE_WRAPPER (__rep_.__l .__data_ );
1998
2008
}
1999
2009
@@ -2137,6 +2147,7 @@ private:
2137
2147
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_no_alias (const value_type* __s, size_type __n);
2138
2148
2139
2149
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_to_end (size_type __pos) {
2150
+ _LIBCPP_ASSERT_INTERNAL (__pos <= capacity (), " Trying to erase at position outside the strings capacity!" );
2140
2151
__null_terminate_at (std::__to_address (__get_pointer ()), __pos);
2141
2152
}
2142
2153
0 commit comments