Value type of map need not be default copyable
Paolo Carlini
paolo.carlini@oracle.com
Mon Aug 13 12:10:00 GMT 2012
On 08/12/2012 10:00 PM, François Dumont wrote:
> On 08/11/2012 03:47 PM, Marc Glisse wrote:
>> On Sat, 11 Aug 2012, François Dumont wrote:
>>
>>> Your remark on using std::move rather than std::forward Marc made
>>> sens but didn't work. I don't understand why but the new test is
>>> showing that std::forward works. If anyone can explain why std::move
>>> doesn't work I am interested.
>>
>> What testcase failed? I just tried the 2.cc file you added with the
>> patch, and replacing forward<key_type>(__k) with move(__k) compiled
>> fine.
>>
>
> You are right, I replaced std::forward<key_type> with
> std::move<key_type> forcing a wrong type deduction in std::move. With
> a simple std::move() it works fine. So here is the patch again.
>
> 2012-08-10 François Dumont <fdumont@gcc.gnu.org>
> Ollie Wild <aaw@google.com>
>
> * include/bits/hashtable.h
> (_Hashtable<>_M_insert_multi_node(hash_code, node_type*)): New.
> (_Hashtable<>_M_insert(_Args&&, false_type)): Use latter.
> (_Hashtable<>::_M_emplace(false_type, _Args&&...)): Likewise.
> (_Hashtable<>::_M_insert_bucket): Replace by ...
> (_Hashtable<>::_M_insert_unique_node(size_type, hash_code,
> node_type*)):
> ... this, new.
> (_Hashtable<>::_M_insert(_Args&&, true_type)): Use latter.
> (_Hashtable<>::_M_emplace(true_type, _Args&&...)): Likewise.
> * 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/util/testsuite_counter_type.h: New.
> * testsuite/23_containers/unordered_map/operators/2.cc: New.
>
> Tested under Linux x86_64.
>
> Ok for trunk ?
Ok, thanks!
Paolo.
PS: you may want to remove the trailing blank line of
testsuite_counter_type.h
More information about the Libstdc++
mailing list