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: std::regex: inserting std::wregex to std::vector loses some std::wregex values


On Tue, Sep 16, 2014 at 4:37 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 16 September 2014 21:39, Tim Shen wrote:
>> shared_ptr can still be used as a "copy-on-write" mechanism, as long
>> as it does a regex recompile when imbuing.
>
> And as long as there are no references from the shared data to
> per-instance members.
>
>> it makes copy
>> constructing/assigning fast but imbue slow.
>
> Sounds like a good trade off to me.
>
>> shared_ptr, however, has
>> larger overhead, but I think it's affordable; we can make _NFA
>> intrusively shared to reduce it.
>
> IMHO the overhead of shared_ptr is entirely acceptable. I'd prefer
> reusing shared_ptr to adding yet another form of reference counting in
> the library.

I get the answer from you ;)
http://stackoverflow.com/questions/13912286/intrusive-ptr-in-c11

So I'll change the patch to move _M_traits to _NFA, and add a new
basic_regex::_M_loc member.

Should the abi compatible fix be another patch for branch 4.9? In
which the move ctor is not noexcept and calls the copy ctor?


-- 
Regards,
Tim Shen


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