unordered containers emplace

Paolo Carlini paolo.carlini@oracle.com
Wed Dec 7 13:32:00 GMT 2011


On 12/07/2011 02:14 PM, Jonathan Wakely wrote:
> I might be wrong, as I'm only going by reading the cotnainer
> requirements not all the past discussion, but I think emplace should
> just do alloc.construct(p, std::forward<Args>(args)...)
In fact in the actual C++11 there isn't much *explicitly* about the 
things I mentioned, which, for sure, at some point in the past people 
envisaged.
> If the value_type is a std::pair and the user wants to create it with
> more than two arguments, they can call emplace( piecewise_construct,
> make_tuple(...), make_tuple(...) )
>
> I don't think the library should call the piecewise constructor
> directly, only when the function parameter pack contains
> piecewise_construct_t, and the right constructor will be chosen by
> normal overload resolution.
Good, good. Then, probably we want to add at least a testcase exercising 
the kind of call you mentioned, would be also useful for the users in 
terms of "documentation", example usage.

In the meanwhile I saw your other message, now I remember, at least I'm 
happy that the same "weird" idea occurred to Pablo too ;)

Paolo.



More information about the Libstdc++ mailing list