This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: unordered containers emplace
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Date: Wed, 07 Dec 2011 21:43:13 +0100
- Subject: Re: unordered containers emplace
- References: <4EDBD234.8030208@gmail.com> <4EDF55A2.5080104@oracle.com> <4EDFCE80.5060802@gmail.com>
Hi,
On 12/07/2011 09:37 PM, François Dumont wrote:
On 12/07/2011 01:01 PM, Paolo Carlini wrote:
Hi,
Hi
This is the implementation of emplace and emplace_hint for
unordered containers. For the moment in emplace_hint the hint
iterator is not considered like in the current insert with hint
implementation.
detail: for consistency with _M_insert, I think we should swap the
arguments of _M_emplace, last true_type / false_type.
This is what I did to begin but it failed to compile, g++ do not
know then when to stop considering arguments as part of the _Args....
I consider it was a normal limitation of using variadic templates, if
so I can invert parameters of _M_insert to have consistency.
Of course, sorry. This is absolutely expected, I just didn't consider,
formally, that _M_insert is not variadic.
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.
Good point, I hadn't notice this potential issue. I am lucky that
the library is well designed making my patch not so bad. I will add
the necessary tests and resubmit a patch.
Essentially, I would just recommend adding some tests per Jon's comment.
Thanks!
Paolo.