Thiago described Qt6 QString as { QArrayData *d; ushort* b; qsize size }. That is pretty close to QStringView, just extra *d makes it slightly bigger.
This is how I understand this class: QString will have (typical) case when b points into d. QString own one reference in d in this case. QString will have special case when b points to text section and d does not own anything. QString will have special case for SSO. Can QString have special case for not owned, non persistent b pointer (non-owning / view mode)? Non-owning QString can be created with special static QString method. It stays non-owning only while being passed through const &. Code that cares about keeping QString in view mode, must stick to const QString & all the time. Copy assignment on non-owning QString results in owning QString - it triggers deep copy into newly created shared data. It solves the queued connection problem that existed with QStringView class. I suppose that queued connection internally performs QString copy. I have no idea about performance implications for code paths that do not care about this use case. But having just one string class would be very convenient. Kind regards Brano
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development