[v3] Fix allocator-aware container requirements for forward_list
Jonathan Wakely
jwakely.gcc@gmail.com
Fri Nov 2 01:34:00 GMT 2012
This fixes the new LWG issue 2210 and only uses allocator::construct()
for the elements not the nodes.
2012-11-02 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/forward_list.h (forward_list(size_type)): Add missing
allocator parameter.
(_Fwd_list_node_base): Use NSDMI and define constructor as defaulted.
(_Fwd_list_node::_M_value): Replace with uninitialized storage.
(_Fwd_list_node::_M_valptr()): Define functions to access storage.
(_Fwd_list_iterator, _Fwd_list_const_iterator): Use _M_valptr.
(_Fwd_list_base::_M_create_node): Only use allocator to construct the
element not the node.
* include/bits/forward_list.tcc (_Fwd_list_base::_M_erase_after): Only
use allocator to destroy the element not the node.
* testsuite/23_containers/forward_list/cons/11.cc: Remove unused
headers.
* testsuite/23_containers/forward_list/cons/12.cc: Likewise.
* testsuite/23_containers/forward_list/cons/13.cc: New.
* testsuite/23_containers/forward_list/cons/14.cc: New.
Tested x86_64-linux, committed to trunk.
The pretty printers need an update, which I'll do asap.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20121102/653a5846/attachment.txt>
More information about the Libstdc++
mailing list