Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2005-08-19 07:34:30


Hello,

I found another bug in resize_internal: If I create a vector of size zero and
resize it, then the data_ member remains a null pointer. The assignment
  data_ = data
must always be done.

---8x----------------------

Index: storage.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/numeric/ublas/storage.hpp,v
retrieving revision 1.65
diff -u -p -r1.65 storage.hpp
--- storage.hpp 16 Aug 2005 18:07:21 -0000 1.65
+++ storage.hpp 19 Aug 2005 12:30:51 -0000
@@ -107,7 +107,7 @@ namespace boost { namespace numeric { na
         BOOST_UBLAS_INLINE
         void resize_internal (size_type size, value_type init, bool preserve)
{
             if (size != size_) {
- pointer data;
+ pointer data = 0;
                 if (size) {
                     data = alloc_.allocate (size);
                     if (preserve) {
@@ -147,8 +147,8 @@ namespace boost { namespace numeric { na
                         iterator_destroy (i);
                     }
                     alloc_.deallocate (data_, size_);
- data_ = data;
                 }
+ data_ = data;
                 size_ = size;
             }
         }