📄 _deque.h
字号:
# if !defined (_STLP_USE_ITERATOR_WRAPPER)
: _M_impl(__first, __last) {}
# else
{ 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 */
deque(__move_source<_Self> src)
: _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
_Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }
void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
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(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
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),
typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
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
_STLP_END_NAMESPACE
#endif /* _STLP_SPECIALIZED_DEQUE_H */
// Local Variables:
// mode:C++
// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -