This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: unordered containers emplace
On 7 December 2011 13:14, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 7 December 2011 12:01, Paolo Carlini wrote:
>> Much more importantly, I don't think we are doing the right thing for map /
>> multimap; honestly I cannot say to have followed in any special detail the
>> standardization of the piecewise_construct_t things, at the corresponding
>> ISO Meetings, but I think we have to involve that pair constructor in this
>> case. I'm adding Jon and Chris in CC for you to have more help on this,
>> please also have a look to various papers authored by Pablo Halpern et al
>> over the last 2/3 years.
>>
>
> 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)...)
>
> 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.
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3178.htm
which was rejected and added to the issues list as NAD:
http://lwg.github.com/issues/lwg-closed.html#2006
"Alternatively, the status quo is to use piecewise_construct_t if you
want to construct an object."