STLPORT vector Resize失败具体是执行到:
template <class _Tp, class _Alloc>
void vector<_Tp, _Alloc>::_M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
size_type __fill_len, bool __atend ) {
const size_type __old_size = size();
size_type __len = __old_size + (max)(__old_size, __fill_len); pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
pointer __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(this->_M_start, __pos, __new_start));
// handle insertion
__new_finish = _STLP_PRIV __fill_n(__new_finish, __fill_len, __x);
if (!__atend)
__new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(__pos, this->_M_finish, __new_finish)); // copy remainder
_M_clear();
_M_set(__new_start, __new_finish, __new_start + __len);
}中坚的pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); 得到的__new_start为空,但是我的内存还够用
template <class _Tp, class _Alloc>
void vector<_Tp, _Alloc>::_M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
size_type __fill_len, bool __atend ) {
const size_type __old_size = size();
size_type __len = __old_size + (max)(__old_size, __fill_len); pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
pointer __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(this->_M_start, __pos, __new_start));
// handle insertion
__new_finish = _STLP_PRIV __fill_n(__new_finish, __fill_len, __x);
if (!__atend)
__new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(__pos, this->_M_finish, __new_finish)); // copy remainder
_M_clear();
_M_set(__new_start, __new_finish, __new_start + __len);
}中坚的pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); 得到的__new_start为空,但是我的内存还够用
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货