[PATCH] D38757: [libc++] Fix PR34898 - vector iterator constructors and assign method perform push_back instead of emplace_back.
David L. Jones via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 13 17:06:28 PDT 2017
dlj requested changes to this revision.
dlj added a comment.
This revision now requires changes to proceed.
Hmm, looking more at this change... while it does make the behaviour consistent for Forward and Input iterators, I think it's just making them both do the wrong thing.
Specifically, based on this:
"... i and j denote iterators satisfying input iterator requirements and refer to elements implicitly convertible to value_type..."
https://timsong-cpp.github.io/cppwp/n4659/container.requirements#sequence.reqmts-3
So, for example, in test_emplacable_concept, the vector constructor should be diagnosed, because there is no way to *implicitly* convert from the dereferenced iterator type to the inserted type. The selected constructor is explicit. Using emplacement just omits a *second* potentially-expensive conversion: the explicit constructor behaviour (invoked through forwarding) may still be undesired.
https://reviews.llvm.org/D38757
More information about the cfe-commits
mailing list