-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
I was looking at what swap was doing for arrays and in the MSVC stl it loops trough the array and swap each element. (libstdc++ and libc++ do the same thing).
The thing is, it was an array of std::byte, I was surprised that none of the STL have specializations for trivially copyable/movable types that would call memcopy. Now I figure, this is maybe how the spec is. So my first question is there something preventing those specialization from existing.
My second question which is maybe off-topic for this is even tough clang and gcc also do a loop, "I believe" their auto vectorizer see the pattern and emits SSE instructions but MSVC doesn't it still loops.
Here is a compiler explorer link
https://godbolt.org/z/W8GxPv1ov
Now this is maybe something more for the compiler team, I don't know.
In any case I saw the differences and I thought I would point it out.
Thank you