_deque.h

来自「stl的源码」· C头文件 代码 · 共 391 行 · 第 1/2 页

H
391
字号
  { insert(end(), __first, __last); }#    endif#  endif#else  deque(const_pointer __first, const_pointer __last,        const allocator_type& __a = allocator_type() )    : _M_impl(cast_traits::to_storage_type_cptr(__first),              cast_traits::to_storage_type_cptr(__last),              _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}  deque(const_iterator __first, const_iterator __last,        const allocator_type& __a = allocator_type() )    : _M_impl(ite_cast_traits::to_storage_type_cite(__first),              ite_cast_traits::to_storage_type_cite(__last),              _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}#endif /* _STLP_MEMBER_TEMPLATES */#if !defined (_STLP_NO_MOVE_SEMANTIC)  deque(__move_source<_Self> src)    : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}#endif  _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }  void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)  void _M_swap_workaround(_Self& __x) { swap(__x); }#endif  void assign(size_type __n, const value_type& __val) {    _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val));  }#if defined (_STLP_MEMBER_TEMPLATES)#  if defined (_STLP_USE_ITERATOR_WRAPPER)private:  template <class _Integer>  void _M_assign_dispatch(_Integer __n, _Integer __val,                          const __true_type&)  { _M_impl.assign(__n, __val); }  template <class _InputIterator>  void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,                          const __false_type&) {    _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),                   _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));  }public:#  endif  template <class _InputIterator>  void assign(_InputIterator __first, _InputIterator __last) {#  if defined (_STLP_USE_ITERATOR_WRAPPER)    typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;    _M_assign_dispatch(__first, __last, _Integral());#  else    _M_impl.assign(__first, __last);#  endif  }#else  void assign(const_pointer __first, const_pointer __last)  { _M_impl.assign(cast_traits::to_storage_type_cptr(__first),                   cast_traits::to_storage_type_cptr(__last)); }  void assign(const_iterator __first, const_iterator __last)  { _M_impl.assign(ite_cast_traits::to_storage_type_cite(__first),                   ite_cast_traits::to_storage_type_cite(__last)); }#endif /* _STLP_MEMBER_TEMPLATES */#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)  void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))#else  void push_back(const value_type& __t)#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/  { _M_impl.push_back(cast_traits::to_storage_type_cref(__t)); }#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)  void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))#else  void push_front(const value_type& __t)#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/  { _M_impl.push_front(cast_traits::to_storage_type_cref(__t)); }# if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)  void push_back()  { _M_impl.push_back(); }  void push_front() { _M_impl.push_front(); }# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/  void pop_back()  { _M_impl.pop_back(); }  void pop_front() { _M_impl.pop_front(); }#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)  iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))#else  iterator insert(iterator __pos, const value_type& __x)#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/  { return ite_cast_traits::to_value_type_ite(_M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),                                                             cast_traits::to_storage_type_cref(__x))); }#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)  iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/  void insert(iterator __pos, size_type __n, const value_type& __x)  { _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, cast_traits::to_storage_type_cref(__x)); }#if defined (_STLP_MEMBER_TEMPLATES)#  if defined (_STLP_USE_ITERATOR_WRAPPER)private:  template <class _Integer>  void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,                          const __true_type&) {    _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, __val);  }  template <class _InputIterator>  void _M_insert_dispatch(iterator __pos,                          _InputIterator __first, _InputIterator __last,                          const __false_type&) {    _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),                   _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),                   _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));  }public:#  endif  template <class _InputIterator>  void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {#  if defined (_STLP_USE_ITERATOR_WRAPPER)    // Check whether it's an integral type.  If so, it's not an iterator.    typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;    _M_insert_dispatch(__pos, __first, __last, _Integral());#  else    _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __first, __last);#  endif  }#else /* _STLP_MEMBER_TEMPLATES */  void insert(iterator __pos,              const_pointer __first, const_pointer __last) {    _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),                   cast_traits::to_storage_type_cptr(__first),                   cast_traits::to_storage_type_cptr(__last));  }  void insert(iterator __pos,              const_iterator __first, const_iterator __last) {    _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),                   ite_cast_traits::to_storage_type_cite(__first),                   ite_cast_traits::to_storage_type_cite(__last));  }#endif /* _STLP_MEMBER_TEMPLATES */#if !defined (_STLP_DONT_SUP_DFLT_PARAM)  void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))#else  void resize(size_type __new_size, const value_type& __x)#endif /*_STLP_DONT_SUP_DFLT_PARAM*/  { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); }#if defined (_STLP_DONT_SUP_DFLT_PARAM)  void resize(size_type __new_size) { _M_impl.resize(__new_size); }#endif /*_STLP_DONT_SUP_DFLT_PARAM*/  iterator erase(iterator __pos)  { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__pos))); }  iterator erase(iterator __first, iterator __last)  { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__first),                                                            ite_cast_traits::to_storage_type_ite(__last))); }  void clear() { _M_impl.clear(); }private:  _Base _M_impl;};#if defined (deque)#  undef deque_STLP_MOVE_TO_STD_NAMESPACE#endif#undef DEQUE_IMPL#if defined (__BORLANDC__) || defined (__DMC__)#  undef typename#endif_STLP_END_NAMESPACE#endif /* _STLP_SPECIALIZED_DEQUE_H */// Local Variables:// mode:C++// End:

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?