[libcxx-commits] [libcxx] [libc++] Speed up vector<bool> copy/move-ctors [1/3] (PR #120132)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Feb 2 08:15:00 PST 2025
https://github.com/philnik777 requested changes to this pull request.
> LGTM with comments applied. I would also like @philnik777 to take another look.
>
> Personally, I find the code a lot easier to read after this PR. We call `std::copy` directly, which everyone knows well, and we set the size explicitly from the constructor. That removes the need for calling `__construct_at_end`, which has a strange contract like that of only being called when the vector is empty.
What strange contract are you talking about? AFAICT the only precondition is that there is enough space to construct the elements.
I don't really care whether we call `__construct_at_end` or use `std::copy` directly, but I still find `std::copy(__v.begin(), __v.end(), begin())` _much_ more readable than the current proposal. If the only reason for this PR is readability I don't see how the current proposal is any better than the status quo.
https://github.com/llvm/llvm-project/pull/120132
More information about the libcxx-commits
mailing list