This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 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.


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