402N/A # pragma warning (disable: 4345)
402N/A _RWSTD_NAMESPACE (std) {
402N/A+ _RWSTD_REQUIRES (size () < max_size () - __rlen,
402N/A+ (_RWSTD_ERROR_LENGTH_ERROR,
402N/A+ _RWSTD_FUNC ("basic_string::assign (const "
402N/A+ "basic_string&, size_type, size_type)"),
402N/A+ size (), max_size () - __rlen));
402N/A return replace (size_type (), size (), __str, __pos, __rlen);
402N/A- _RWSTD_REQUIRES (size () <= max_size () - __rlen,
402N/A+ _RWSTD_REQUIRES (size () < max_size () - __rlen,
402N/A (_RWSTD_ERROR_LENGTH_ERROR,
402N/A _RWSTD_FUNC ("basic_string::insert (size_type, const "
402N/A "basic_string&, size_type, size_type)"),
402N/A (_RWSTD_ERROR_LENGTH_ERROR,
402N/A _RWSTD_FUNC ("basic_string::insert (size_type, "
402N/A "const basic_string&)"),
402N/A const size_type __size0 = size ();
402N/A- __n2 = traits_type::length (__s);
402N/A _RWSTD_REQUIRES (__pos1 <= __size0,
402N/A (_RWSTD_ERROR_OUT_OF_RANGE,
402N/A _RWSTD_FUNC ("basic_string::replace (size_type, size_type"
402N/A // number of characters to delete
402N/A const size_type __xlen = _C_min (__n1, __size0 - __pos1);
402N/A- _RWSTD_REQUIRES (__n2 <= max_size (),
402N/A+ _RWSTD_REQUIRES (__n2 < max_size (),
402N/A (_RWSTD_ERROR_LENGTH_ERROR,
402N/A _RWSTD_FUNC ("basic_string::replace (size_type, size_type"
402N/A ", const_pointer, size_type)"),
402N/A- _RWSTD_REQUIRES (__size0 - __xlen <= max_size () - __n2,
402N/A+ _RWSTD_REQUIRES (__size0 - __xlen < max_size () - __n2,
402N/A (_RWSTD_ERROR_LENGTH_ERROR,
402N/A _RWSTD_FUNC ("basic_string::replace (size_type, size_type"
402N/A ", const_pointer, size_type)"),
402N/A const size_type __xlen = _C_min (__size0 - __pos, __len);
402N/A- _RWSTD_REQUIRES (__size0 - __xlen <= max_size () - __count,
402N/A+ _RWSTD_REQUIRES (__size0 - __xlen < max_size () - __count,
402N/A (_RWSTD_ERROR_LENGTH_ERROR,
402N/A _RWSTD_FUNC ("basic_string::replace (size_type, "
402N/A "size_type, size_type, value_type)"),
402N/A typedef _TYPENAME traits_type::char_type value_type;
402N/A typedef _Alloc allocator_type;
402N/A typedef _TYPENAME allocator_type::size_type size_type;
402N/A+ typedef _TYPENAME allocator_type::pointer pointer;
402N/A+ typedef _TYPENAME allocator_type::const_pointer const_pointer;
402N/A typedef _STD::basic_string<_CharT, _Traits, _Alloc> _C_string_type;
402N/A+ if (_RW::__rw_is_pointer<_InputIter>::_C_val) {
402N/A+ const const_pointer __beg2 =
402N/A+ _RWSTD_REINTERPRET_CAST (const_pointer,
402N/A+ const const_pointer __end2 =
402N/A+ _RWSTD_REINTERPRET_CAST (const_pointer,
402N/A+ // ranges don't overlap, do simple replace
402N/A+ if (__end1 < __beg2 || __end2 < __beg1)
402N/A+ return __s.__replace_aux (__first1, __last1, __first2, __last2);
402N/A+ // otherwise fall through and make a copy first
402N/A // use a (probably) faster algorithm if possible
402N/A if (_STD::__is_bidirectional_iterator (_RWSTD_ITERATOR_CATEGORY(_InputIter,
402N/A- return __s.__replace_aux (__first1, __last1, __first2, __last2);
402N/A typedef _RW::__string_ref<value_type, traits_type, allocator_type>
402N/A+ typedef _RWSTD_ALLOC_TYPE (allocator_type, value_type)
402N/A # else // if !defined (_RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES)
402N/A template<class _CharT, class _Traits, class _Allocator>
402N/A # endif // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
402N/A+ // assumes that the two ranges do not overlap
402N/A _RWSTD_ASSERT_RANGE (__first1, __s._C_make_iter (__s._C_data
402N/A _RWSTD_ASSERT_RANGE (__first1, __last1);
402N/A size_type __slen = __ssize - __pos;
402N/A size_type __xlen = __n < __slen ? __n : __slen;
402N/A (_RWSTD_ERROR_LENGTH_ERROR,
402N/A _RWSTD_FUNC ("basic_string::__replace_aux (iterator, "
402N/A "iterator, InputIterator, InputIterator)"),
402N/A __s._C_unlink (__temp->data ());
402N/A+ const_reference __ref =
402N/A+ _RWSTD_REINTERPRET_CAST (const_reference, *__first2);
402N/A+ for (__d = 0; __d < __n2; __d++)
402N/A+ traits_type::assign (*(__tmp + __d), *__first2++);
402N/A // Current reference has enough room.
402N/A traits_type::move (__s._C_data + __pos + __n2,
402N/A __s._C_data + __pos + __n,
402N/A+ traits_type::copy (__s._C_data + __pos, __tmp, __n2);
402N/A for (__d = 0; __d < __n2; __d++)
402N/A traits_type::assign (*(__s._C_data + __pos + __d),
402N/A __s._C_pref ()->_C_size._C_size = __len;
402N/A traits_type::assign (__s._C_data [__len], value_type ());