[Patch, libstdc++/64584, libstdc++/64585] Clear basic_regex after imbue and make assign exception tolerant

Tim Shen timshen@google.com
Sat Apr 11 20:10:00 GMT 2015


On Sun, Jan 18, 2015 at 1:22 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
> On 17/01/15 16:53 -0800, Tim Shen wrote:
>>
>> Then "std::move on a pointer definitely doesn't pessimize" is true.
>> Here I read pessimize as "less efficient".
>
>
> Well without optimization it certainly is less efficient, because you
> get calls to std::move (just compare the code for foo and bar at
> http://goo.gl/lTxgBw), but I'm confident even at -O1 they disappear
> and its nothing to worry about.
>
> Anyway, I'll review your new patches tomorrow - thanks.

I realized that std::move() on an user defined iterator may cause
compilation error, if user explicitly deletes its move ctor/assign.

So what we really need is a sfinae that detects move ctor/assign
first; if nothing usable is found, fall back to copy ctor/assign.

It now sounds like a premature optimization to me :). Maybe I should
just change it back to copying?


-- 
Regards,
Tim Shen



More information about the Libstdc++ mailing list