std::regex: inserting std::wregex to std::vector loses some std::wregex values

Jonathan Wakely jwakely@redhat.com
Thu Oct 2 08:49:00 GMT 2014


On 01/10/14 23:44 -0700, Tim Shen wrote:
>> This just copies but we could still make it slightly more efficient by
>> moving _M_original_str (then resetting __rhs to an empty state).
>>
>>      basic_regex(basic_regex&& __rhs)
>>      : _M_flags(__rhs._M_flags), _M_original_str(std::move(_M_original_str))
>>      {
>>        this->imbue(__rhs.getloc());
>>        __rhs._M_automaton.reset();
>>      }
>>
>> This is only slightly more efficient, and still needs to allocate
>> memory for the NFA, so I'm not sure if it's worth it. Your call.
>
>Yes let's do it. Done.
>
>> Because imbue() returns the old locale you can swap them like this:
>>
>>        imbue(__rhs.imbue(getloc()));
>>
>
>Done.

Looks good - thanks.



More information about the Libstdc++ mailing list