vector::clear calls erase(begin(), end()), which has an unnecessary call to
memmove, in addition to a function call overhead. The fix results in a
2-instruction clear for simple types.
Compiling the following (-O2 -save-temps) shows the difference:
#include
using std::vector;
int main() {
ve
>
> vector::clear calls erase(begin(), end()), which has an unnecessary call to
> memmove, in addition to a function call overhead. The fix results in a
> 2-instruction clear for simple types.
>
> Compiling the following (-O2 -save-temps) shows the difference:
>
> #include
>
> using std::vecto