https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119620

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to 康桓瑋 from comment #0)
> I don't know why the standard sometimes constrains emplace(), sometimes only
> constrains insert(), and sometimes constrains neither.

flat_multiset::emplace is specified to construct an element explicitly, which
requires is_constructible_v<value_type, Args...> *in addition to* being able to
emplace that object into the container as shown in the Effects paragraph.

flat_set::emplace is not specified to unconditionally construct an object
outside the container (even though for some calls to emplace it does need to do
that).

It seems like we're missing a precondition on flat_set::emplace, or that
flat_multiset::emplace could be specified differently so that it doesn't need
to construct an element outside the container.

Reply via email to