This is the mail archive of the 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 30, 2014 at 5:15 AM, Jonathan Wakely <> wrote:
> Please put the PR number in the ChangeLog, so it updates Bugzilla
> automatically.

Good catch ;)

> You've spelled it "ompatibility" everywhere. I think we only need the
> note once, maybe on the move constructor or rvalue basic_regex::assign.

Sorry for misspelling :(. Done.

> 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()));


Tim Shen

Attachment: a.diff
Description: Text document

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