debug vector move issue
François Dumont
francois.cppdevs@free.fr
Wed Sep 15 20:23:00 GMT 2010
Hi
While working on debug forward_list I noticed that all debug
containers were missing move constructor and move assignment operator
from normal container. I started adding those and will submit a patch
for that however there is a problem on vector. Attached is a test I
wrote for this container.
When compiled with the necessary attached patch on debug vector it works
fine. However when you define _GLIBCXX_DEBUG_PEDANTIC the test
a.capacity() == r.capacity() fails. This is because when you create a
normal vector by moving a debug one internal memory is transferred but
the debug vector _M_guaranteed_capacity is not reseted. This result in
the test by the moved debug vector instance 'a' announcing a capacity of
1 when in fact it is 0.
I see no real good solution to this problem, _M_guarantied_capacity
seemed to be impossible to maintain when the debug container is moved.
Maybe putting this data in the allocator could help, I need to investigate.
Any thoughts ?
Francois
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vector.patch
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20100915/1ff48e4c/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: moveable.cc
Type: text/x-c
Size: 2016 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20100915/1ff48e4c/attachment.bin>
More information about the Libstdc++
mailing list