Re: optimize std::vector move assignment

2018-07-25 Thread Marc Glisse
On Wed, 25 Jul 2018, Jonathan Wakely wrote: _M_copy_data is not really needed, we could add a defaulted assignment operator, or remove the move constructor (and call a new _M_clear() from the 2 users), etc. However, it seemed the least intrusive, the least likely to have weird consequences.

Re: optimize std::vector move assignment

2018-07-25 Thread Jonathan Wakely
On 25/07/18 14:38 +0200, Marc Glisse wrote: Hello, I talked about this last year (https://gcc.gnu.org/ml/gcc-patches/2017-04/msg01063.html and thread), this tweaks std::vector move assignment to help gcc generate better code for it. Ah yes, thank for revisiting it. For this code #include

optimize std::vector move assignment

2018-07-25 Thread Marc Glisse
Hello, I talked about this last year (https://gcc.gnu.org/ml/gcc-patches/2017-04/msg01063.html and thread), this tweaks std::vector move assignment to help gcc generate better code for it. For this code #include #include typedef std::vector V; void f(V&a,V&b){a=std::move(b);} with -O2 -f