[libcxx-commits] [libcxx] Optimize __assign_with_sentinel in std::vector (PR #113852)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 1 09:08:25 PDT 2024
================
@@ -1031,9 +1031,14 @@ template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
----------------
ldionne wrote:
http://eel.is/c++draft/container.requirements#sequence.reqmts-57 says:
> T is Cpp17EmplaceConstructible into X from *i and assignable from *i[.](http://eel.is/c++draft/container.requirements#sequence.reqmts-57.sentence-1) For vector, if the iterator does not meet the forward iterator requirements ([[forward.iterators]](http://eel.is/c++draft/forward.iterators)), T is also Cpp17MoveInsertable into X[.](http://eel.is/c++draft/container.requirements#sequence.reqmts-57.sentence-2) Neither i nor j are iterators into a[.](http://eel.is/c++draft/container.requirements#sequence.reqmts-57.sentence-3)
Since we do have a requirement that T is assignable from `*i`, I think we're allowed to do this.
Can you check if we already have a benchmark that would cover this inside our vector benchmarks, and if not, add one?
https://github.com/llvm/llvm-project/pull/113852
More information about the libcxx-commits
mailing list