[Development] QList
Thiago Macieira
thiago.macieira at intel.com
Thu Mar 23 19:20:17 CET 2017
On quarta-feira, 22 de março de 2017 01:27:54 PDT Marc Mutz wrote:
> On Wednesday 22 March 2017 07:37:27 Thiago Macieira wrote:
> > Another thing I'd want is for QStringView to carry the pointer to the
> > QArrayData like QString does.
>
> NAK to inheriting from QStringView, publicly or privately. NAK to adding
> another pointer.
>
> If you need a base class for your Q6String, use QStringRef.
I thought QStringView was supposed to deprecate QStringRef and thus we'd
remove it in a later version. I can't very well derive the most important
class in Qt from a deprecated class.
> It's already got
> what you want: tight coupling with QString. QStringView will not be that
> base class. QStringView will model whatever std::string_view models.
> Anything that pessimises QStringView as a wrapper around a char16_t literal
> is not acceptable.
Yeah, that is a concern I have. I'm loathe to add the extra pointer and I'd
prefer not to. Like I said, for QString+QStringView, we can use the begin
pointer with the extra bit set, but this won't work for QByteArray.
> I understand that you sit on a pile of finished changes to QString just
> waiting for Qt 6 to come around. And I welcome it (I think, we'll see when
> you upload some of it to Gerrit). But leave QStringView out of it.
Actually, the QStringView class makes me need to sit down and rewrite a lot of
the code. The pile of changes to QArrayData, QTypedArrayData,
QArrayDataPointer, QArrayDataOps is probably valid, along with the QVector
rewrite and the moc reversal to not use QByteArrayPrivate, but QStringView
invalidates many of the assumptions I had for QString. I am also assuming
QByteArray should follow QString's lead in whatever it does.
The changes have been public for 5 years. They're in my qtbase in GitLab[1].
They end with the commit "Cache the fact that a QString is US-ASCII only"
(currently [2], but link will be invalid after my next rebase + push; also, I
need to stop using QPair in it).
[1] https://gitlab.com/thiagomacieira/qtbase/commits/master
[2] https://gitlab.com/thiagomacieira/qtbase/commit/d965fe9cd15c432a1f4306739
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list