Boost logo

Ublas :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2005-08-19 07:46:43


Michael Stevens wrote:

> On Wednesday 17 August 2005 23:41, Neal Becker wrote:
>> Here is a revised patch. I think I prefer this method to control
>> initialization (pass an argument to vector constructor)
>
> In your patch you have
>
> ~unbounded_array () {
> if (size_) {
> - std::_Destroy (begin(), end(), alloc_);
> - alloc_.deallocate (data_, size_);
> + const iterator i_end = end();
> + for (iterator i = begin (); i != i_end; ++i) {
> + iterator_destroy (i);
> + }
> + alloc_.deallocate (data_, size_);
> }
> }
>
> Any ideas where _Destroy comes from and what it does. I assume it is not
> part of the STL.

I have done a quick benchmark on this. It appears that in at least one
simple case I tried, it didn't make any difference to use this patch. I
suppose gcc-4.0.1 is smart enough to eliminate the destruction of Complex
values without the optimization of using std::_Destroy. Therefore, I
withdraw this part of the patch.