[Development] QList

Edward Welbourne edward.welbourne at qt.io
Wed Mar 22 10:36:19 CET 2017

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.

Marc Mutz (22 March 2017 09:27)
> NAK to inheriting from QStringView, publicly or privately. NAK to
> adding another pointer.

Is there scope for a common (perhaps private) base, to be used by (at
least) QString and QStringView, something along the lines of a Java
interface ?  It needn't actually be pure virtual, if we can chose the
right factoring of what's different between the assorted strings, so
don't be too slavish in following Java's interfaces.  They all package
string data and they share many methods in common, many of which can
share (indeed, at present, *do* share, as static functions)

The design of string classes always amuses me: every text-book on
object-oriented design (that I've seen) launches into it as an example
and *all* of them give results that I wouldn't want to use in production
code.  The problem turns out to be *hard* because we do such a lot with
strings; and allocation *isn't* a negligible cost.  Much of what's hard
about it is subtle: I've yet to see a string class I thought was Good.
Good luck in your efforts to break that pattern ;^>


More information about the Development mailing list