unordered containers: reuse nodes on assignment

François Dumont frs.dumont@gmail.com
Sun Jun 30 19:22:00 GMT 2013


Hi

     Here is a patch to reuse nodes on assignment. I took the time to 
make _ReuseOrAllocNode more flexible in order to remove 
_MoveReuseOrAllocNode and to use it for the insertion.

     Note that the friend declaration for _ReuseOrAllocNode used to be 
wrong because I had left a template parameter on the friend declaration 
that I finally removed on the definition. But gcc didn't complained and 
use it as a valid friend declaration, should it be reported as a gcc bug ?

2013-07-01  François Dumont  <fdumont@gcc.gnu.org>

     * include/bits/hashtable_policy.h (_ReuseOrAllocNode): Use forward
     pattern.
     (_MoveReuseOrAllocNode): Remove.
     (_Insert_base): Take a functor defining how the node is generated.
     * include/bits/hashtable.h: Adapt.
     (operator=(initializer_list<value_type>)): Reuse node if any.
     * testsuite/23_containers/unordered_set/instantiation_neg.cc:
     Adjust dg-error line number.
     * testsuite/23_containers/unordered_set/
     not_default_constructible_hash_neg.cc: Likewise.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: reuse_node.patch
Type: text/x-patch
Size: 21990 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130630/c94432a9/attachment.bin>


More information about the Gcc-patches mailing list