|
@@ -956,6 +956,8 @@ public:
|
|
|
void resize(size_type __n, value_type __c);
|
|
|
_LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
|
|
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY void __resize_default_init(size_type __n);
|
|
|
+
|
|
|
void reserve(size_type __res_arg = 0);
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
void shrink_to_fit() _NOEXCEPT {reserve();}
|
|
@@ -1010,6 +1012,10 @@ public:
|
|
|
basic_string& append(const value_type* __s, size_type __n);
|
|
|
basic_string& append(const value_type* __s);
|
|
|
basic_string& append(size_type __n, value_type __c);
|
|
|
+
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
|
+ void __append_default_init(size_type __n);
|
|
|
+
|
|
|
template <class _ForwardIterator>
|
|
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
|
|
basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator);
|
|
@@ -2427,6 +2433,23 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
+template <class _CharT, class _Traits, class _Allocator>
|
|
|
+inline void
|
|
|
+basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n)
|
|
|
+{
|
|
|
+ if (__n)
|
|
|
+ {
|
|
|
+ size_type __cap = capacity();
|
|
|
+ size_type __sz = size();
|
|
|
+ if (__cap - __sz < __n)
|
|
|
+ __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
|
|
|
+ pointer __p = __get_pointer();
|
|
|
+ __sz += __n;
|
|
|
+ __set_size(__sz);
|
|
|
+ traits_type::assign(__p[__sz], value_type());
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
template <class _CharT, class _Traits, class _Allocator>
|
|
|
void
|
|
|
basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
|
|
@@ -3082,6 +3105,17 @@ basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)
|
|
|
__erase_to_end(__n);
|
|
|
}
|
|
|
|
|
|
+template <class _CharT, class _Traits, class _Allocator>
|
|
|
+inline void
|
|
|
+basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n)
|
|
|
+{
|
|
|
+ size_type __sz = size();
|
|
|
+ if (__n > __sz) {
|
|
|
+ __append_default_init(__n - __sz);
|
|
|
+ } else
|
|
|
+ __erase_to_end(__n);
|
|
|
+}
|
|
|
+
|
|
|
template <class _CharT, class _Traits, class _Allocator>
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|