Author: faridz Date: Thu Feb 15 06:39:19 2007 New Revision: 507942 URL: http://svn.apache.org/viewvc?view=rev&rev=507942 Log: 2007-02-15 Farid Zaripov * deque: The swap method moved from here ... * deque.cc: ... to here Modified: incubator/stdcxx/trunk/include/deque incubator/stdcxx/trunk/include/deque.cc Modified: incubator/stdcxx/trunk/include/deque URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/deque?view=diff&rev=507942&r1=507941&r2=507942 ============================================================================== --- incubator/stdcxx/trunk/include/deque (original) +++ incubator/stdcxx/trunk/include/deque Thu Feb 15 06:39:19 2007 @@ -893,53 +893,6 @@ template inline void deque<_TypeT, _Allocator>:: -swap (deque<_TypeT, _Allocator> &__rhs) -{ - _RWSTD_ASSERT (_C_is_valid ()); - _RWSTD_ASSERT (__rhs._C_is_valid ()); - - if (get_allocator () == __rhs.get_allocator ()) { - - _STD::swap (_C_beg, __rhs._C_beg); - _STD::swap (_C_end, __rhs._C_end); - _STD::swap (_C_nodes, __rhs._C_nodes); - _STD::swap (_C_node_size, __rhs._C_node_size); - - if (pointer() == _C_beg._C_cur) { - _RWSTD_ASSERT (pointer() == _C_end._C_cur); - _RWSTD_ASSERT ( _C_beg._C_node == &__rhs._C_end._C_cur - && _C_end._C_node == &__rhs._C_end._C_cur); - - _C_beg._C_node = - _C_end._C_node = &_C_end._C_cur; - } - else { - _RWSTD_ASSERT (pointer() != _C_end._C_cur); - } - - if (pointer() == __rhs._C_beg._C_cur) { - _RWSTD_ASSERT (pointer() == __rhs._C_end._C_cur); - _RWSTD_ASSERT ( __rhs._C_beg._C_node == &_C_end._C_cur - && __rhs._C_end._C_node == &_C_end._C_cur); - - __rhs._C_beg._C_node = - __rhs._C_end._C_node = &__rhs._C_end._C_cur; - } - else { - _RWSTD_ASSERT (pointer() != __rhs._C_end._C_cur); - } - } - else { - deque __tmp (*this); - *this = __rhs; - __rhs = __tmp; - } -} - - -template -inline void -deque<_TypeT, _Allocator>:: resize (size_type __new_size, value_type __x /* = value_type () */) { _RWSTD_ASSERT (_C_is_valid ()); Modified: incubator/stdcxx/trunk/include/deque.cc URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/deque.cc?view=diff&rev=507942&r1=507941&r2=507942 ============================================================================== --- incubator/stdcxx/trunk/include/deque.cc (original) +++ incubator/stdcxx/trunk/include/deque.cc Thu Feb 15 06:39:19 2007 @@ -166,6 +166,52 @@ template void deque<_TypeT, _Allocator>:: +swap (deque<_TypeT, _Allocator> &__rhs) +{ + _RWSTD_ASSERT (_C_is_valid ()); + _RWSTD_ASSERT (__rhs._C_is_valid ()); + + if (get_allocator () == __rhs.get_allocator ()) { + + _STD::swap (_C_beg, __rhs._C_beg); + _STD::swap (_C_end, __rhs._C_end); + _STD::swap (_C_nodes, __rhs._C_nodes); + _STD::swap (_C_node_size, __rhs._C_node_size); + + if (pointer() == _C_beg._C_cur) { + _RWSTD_ASSERT (pointer() == _C_end._C_cur); + _RWSTD_ASSERT ( _C_beg._C_node == &__rhs._C_end._C_cur + && _C_end._C_node == &__rhs._C_end._C_cur); + + _C_beg._C_node = + _C_end._C_node = &_C_end._C_cur; + } + else { + _RWSTD_ASSERT (pointer() != _C_end._C_cur); + } + + if (pointer() == __rhs._C_beg._C_cur) { + _RWSTD_ASSERT (pointer() == __rhs._C_end._C_cur); + _RWSTD_ASSERT ( __rhs._C_beg._C_node == &_C_end._C_cur + && __rhs._C_end._C_node == &_C_end._C_cur); + + __rhs._C_beg._C_node = + __rhs._C_end._C_node = &__rhs._C_end._C_cur; + } + else { + _RWSTD_ASSERT (pointer() != __rhs._C_end._C_cur); + } + } + else { + deque __tmp (*this); + *this = __rhs; + __rhs = __tmp; + } +} + + +template +void deque<_TypeT, _Allocator>:: _C_push (bool __at_back, const_reference __x) { _RWSTD_ASSERT (_C_is_valid ());