[Development] QList
Thiago Macieira
thiago.macieira at intel.com
Mon Apr 3 04:59:27 CEST 2017
On domingo, 2 de abril de 2017 15:36:32 PDT Giuseppe D'Angelo wrote:
> > QRegularExpression re("\\d+");
> > auto m = re.match("foo123bar"); // stores a copy
> > assert(m.captured(0) == "123"); // safe -- extracts substring from
> > internal copy
> Questions:
>
> 1) Should this behaviour be deprecated and eventually changed? How to
> make users aware of this behaviour change?
Change what? The ability to run the code above? No.
Whatever we do, we shouldn't break the code above.
> 2) Suppose we add right now a match(QStringView) overload, should it
> still return a QRegularExpressionMatch or a new class with similar API?
> If it still returns a QREM, what would QREM::capturedRef(N) then return
> for a match over a string view?
Anything that takes a QStringView and needs to store should store a QString,
not a QStringView. So if it needs to make a copy, so be it.
That's why I was proposing for QStringView to carry QString's d pointer if it
knows it, so the refcounting can resume. Marc doesn't want that. So we need to
have a QString overload for match(), if necessary.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list