Em sexta-feira, 24 de março de 2017, às 09:18:05 PDT, Marc Mutz escreveu: > > Are you of the opinion that private inheritance has no purpose and should > > never be used? > > No, and if you look at code I have written over the years, you will see that > I do use it. > > One thing I've looked into in the past is this: Q6Polygon should inherit a > Q6VectorBase<QPoint> that also Q6Vector<QPoint> inherits. This will allow > easy specialisation of QVector<T*> by inheriting QBasicVector<const void*>.
Can you elaborate on your thinking? What's QBasicVector and what's QVector? In my tree, I have QVector deriving from QGenericArray only because at the time we were considering doing QList<T> still be a pointer array if sizeof(T) > 32. > I can even think of a similar pattern for QStringView/QLatin1(String| > View)/QUtf8(String|View), though I guess that just enable_if'ing functions > out of the primate template will do the job just fine, so the three classes > would be mere typedefs of the template. > > But in these cases, we're reusing next to 100% of the functionality, by way > of lots of using Base::foo; This is not the case for QString : QStringView. > They're completely unrelated, because one if owning and the other is non- > owning. I still disagree. Yes, there's a difference in ownership, but I don't see that as a deal-breaker. In fact, I see that as a plus: that's why we derive, to add functionality, like owning. And like I said, every QString is a view to itself and the pure inspection functions like indexOf() and contains() are exactly the same. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development