This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Fri, Jan 16, 2015 at 4:12 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
> In that case, why bother using a unique_ptr initially, if it will just
> have to allocate a shared_ptr control block later anyway? It's better
> to use make_shared to reduce the number of allocations, isn't it?

Yes you are right, I didn't notice that shared_ptr<_NFA> can be
implicitly converted to shared_ptr<const _NFA>.

Fixed.

On Fri, Jan 16, 2015 at 4:14 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
>> @@ -675,12 +681,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>         assign(const basic_string<_Ch_type, _Ch_typeraits, _Alloc>& __s,
>>                flag_type __flags = ECMAScript)
>>         {
>> +         auto __traits = _M_traits;
>> +         auto __f = _M_flags;
>>           _M_flags = __flags;
>> -         _M_original_str.assign(__s.begin(), __s.end());
>> -         auto __p = _M_original_str.c_str();
>> -         _M_automaton = __detail::__compile_nfa(__p,
>> -                                                __p +
>> _M_original_str.size(),
>> -                                                _M_traits, _M_flags);
>> +         _M_traits = __traits;
>
>
> What is this assignnment for?

Sorry, I didn't notice that _M_traits doesn't change in this function. Fixed.

On Fri, Jan 16, 2015 at 5:39 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
> If std::move on a pointer definitely doesn't pessimize, then I suppose
> it's no worse and the move is OK.

I'm not 100% sure of that, but isn't moving a pointer the same as copying?


Also adjusted SFINAE (add _CharT* specialization).


-- 
Regards,
Tim Shen

Attachment: 4_9.diff
Description: Text document

Attachment: 5_0.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]