Value type of map need not be default copyable

François Dumont frs.dumont@gmail.com
Wed Aug 8 20:46:00 GMT 2012


On 08/08/2012 03:39 PM, Paolo Carlini wrote:
> On 08/08/2012 03:15 PM, François Dumont wrote:
>> I have also introduce a special std::pair constructor for container 
>> usage so that we do not have to include the whole tuple stuff just 
>> for associative container implementations.
> To be clear: sorry, this is not an option.
>
> Paolo.
>
     Then I can only imagine the attached patch which require to include 
tuple when including unordered_map or unordered_set. The 
std::pair(piecewise_construct_t, tuple<>, tuple<>) is the only 
constructor that allow to build a pair using the default constructor for 
the second member.

     In fact, adding declaration for std::make_tuple and 
std::forward_as_tuple could avoid to include tuple from unordered_set, 
there is no operator[] on unordered_set or unordered_multiset. But I am 
not sure it worth the effort, tell me.

     All unordered tests run under Linux x86_64, normal and debug modes.

2012-08-08  François Dumont  <fdumont@gcc.gnu.org>
         Ollie Wild  <aaw@google.com>

     * include/bits/hashtable.h (_Hashtable<>::_M_insert_bucket):
     Replace by ...
     (_Hashtable<>::_M_insert_node): ... this, new.
     (_Hashtable<>::_M_insert(_Args&&, true_type)): Use latter.
     * include/bits/hashtable_policy.h (_Map_base<>::operator[]): Use
     latter, emplace the value_type rather than insert.
     * include/std/unordered_map: Include tuple.
     * include/std/unordered_set: Likewise.
     * testsuite/23_containers/unordered_map/operators/2.cc: New.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable.patch
Type: text/x-patch
Size: 8372 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120808/7a1edfe5/attachment.bin>


More information about the Gcc-patches mailing list