Value type of map need not be default copyable

Marc Glisse marc.glisse@inria.fr
Thu Aug 9 07:14:00 GMT 2012


On Wed, 8 Aug 2012, François Dumont wrote:

> 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.

I agree that the extra constructor would be convenient (I probably would 
have gone with pair(T&&,__default_construct_t), the symmetric version, and 
enough extra constructors to resolve all ambiguities). Maybe LWG would 
consider doing something.

+         __p = __h->_M_allocate_node(std::piecewise_construct,
+                                     std::make_tuple(__k),
+                                     std::make_tuple());

Don't you want cref(__k)? It might save a move at some point.

-- 
Marc Glisse



More information about the Libstdc++ mailing list