Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-08-26 11:02:29


On Friday 19 August 2005 14:34, Gunter Winkler wrote:
> 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;

Fixed. That was a recently introduced (last few days) while I was
experimenting with data_ initialisation. I had accidentally committed a test
version when I committed the carray_adaptor stuff.

Thanks,
        Michael