You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2007/05/22 23:27:12 UTC
svn commit: r540763 - /incubator/stdcxx/trunk/include/rw/_array.h
Author: sebor
Date: Tue May 22 14:27:12 2007
New Revision: 540763
URL: http://svn.apache.org/viewvc?view=rev&rev=540763
Log:
2007-05-22 Martin Sebor <se...@roguewave.com>
STDCXX-424
* _array.h (dtor): Simplified and implemented without
relying on resize() for efficiency.
(resize): Avoided calling trivial inline functions.
Modified:
incubator/stdcxx/trunk/include/rw/_array.h
Modified: incubator/stdcxx/trunk/include/rw/_array.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/rw/_array.h?view=diff&rev=540763&r1=540762&r2=540763
==============================================================================
--- incubator/stdcxx/trunk/include/rw/_array.h (original)
+++ incubator/stdcxx/trunk/include/rw/_array.h Tue May 22 14:27:12 2007
@@ -67,9 +67,7 @@
__rw_array (const __rw_array&);
- ~__rw_array () {
- resize (0);
- }
+ ~__rw_array ();
__rw_array& operator= (const __rw_array&);
@@ -184,6 +182,16 @@
template <class _TypeT>
+inline
+__rw_array<_TypeT>::
+~__rw_array<_TypeT> ()
+{
+ __rw_destroy (_C_data, _C_data + _C_size);
+ ::operator delete (_C_data);
+}
+
+
+template <class _TypeT>
inline void __rw_array<_TypeT>::swap (__rw_array<_TypeT> &__rhs)
{
pointer __tmp_data = begin ();
@@ -200,9 +208,9 @@
inline void __rw_array<_TypeT>::
resize (size_type __size, const_reference __val /* = value_type () */)
{
- if (begin ()) {
- __rw_destroy (begin (), end ());
- ::operator delete (begin ());
+ if (_C_data) {
+ __rw_destroy (_C_data, _C_data + _C_size);
+ ::operator delete (_C_data);
_C_data = 0;
}