On Oct 19, 2004, at 4:37 AM, Ewan Campbell wrote:
I appear to have made a small error, the warning occurs 'whenever' resize is called.
So the problem now is:
Every time the resize function of multi_array is called, a warning is generated in the use of MSVC++ 6.0's implementation of std::swap.
The problem is solved by commenting out the line swap(this->allocator_,new_array.allocator_); in multi_array.hpp
In general, I'd say this is a dangerous thing to do, particularly because I don't know how std::swap is implemented in your compiler. It seems like the compiler is complaining about an unused variable in the implementation, which does not mean that the allocators are not being swapped.
This hasn't incurred an execution problem under debug or release. Could someone explain this? What is the purpose of this line, and why wasn't it swapping the allocators?
The resize operation preserves as much of the contents of the original array as possible. To do so, it must allocate a new portion of memory and copy the salvageable elements to it. The algorithm essentially builds a new array of the right size and swaps the guts of the original array out. Hope that helps, ron