diff options
Diffstat (limited to 'libstdc++-v3/include/debug/deque')
-rw-r--r-- | libstdc++-v3/include/debug/deque | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque index 0c98006badb..31f708a9c9d 100644 --- a/libstdc++-v3/include/debug/deque +++ b/libstdc++-v3/include/debug/deque @@ -67,12 +67,24 @@ namespace __debug typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.2.1.1 construct/copy/destroy: - explicit deque(const _Allocator& __a = _Allocator()) + explicit + deque(const _Allocator& __a = _Allocator()) : _Base(__a) { } - explicit deque(size_type __n, const _Tp& __value = _Tp(), - const _Allocator& __a = _Allocator()) +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit + deque(size_type __n) + : _Base(__n) { } + + deque(size_type __n, const _Tp& __value, + const _Allocator& __a = _Allocator()) + : _Base(__n, __value, __a) { } +#else + explicit + deque(size_type __n, const _Tp& __value = _Tp(), + const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { } +#endif template<class _InputIterator> deque(_InputIterator __first, _InputIterator __last, @@ -208,6 +220,39 @@ namespace __debug using _Base::size; using _Base::max_size; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + resize(size_type __sz) + { + typedef typename _Base::const_iterator _Base_const_iterator; + typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; + + bool __invalidate_all = __sz > this->size(); + if (__sz < this->size()) + this->_M_invalidate_if(_After_nth(__sz, _M_base().begin())); + + _Base::resize(__sz); + + if (__invalidate_all) + this->_M_invalidate_all(); + } + + void + resize(size_type __sz, const _Tp& __c) + { + typedef typename _Base::const_iterator _Base_const_iterator; + typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; + + bool __invalidate_all = __sz > this->size(); + if (__sz < this->size()) + this->_M_invalidate_if(_After_nth(__sz, _M_base().begin())); + + _Base::resize(__sz, __c); + + if (__invalidate_all) + this->_M_invalidate_all(); + } +#else void resize(size_type __sz, _Tp __c = _Tp()) { @@ -223,6 +268,7 @@ namespace __debug if (__invalidate_all) this->_M_invalidate_all(); } +#endif #ifdef __GXX_EXPERIMENTAL_CXX0X__ using _Base::shrink_to_fit; |