[Development] Are SiCs through #include cleanups considered acceptable?

Olivier Goffart olivier at woboq.com
Fri Apr 10 14:58:24 CEST 2015


On Friday 10. April 2015 14:06:18 André Somers wrote:
> Marc Mutz schreef op 10-4-2015 om 13:29:
> > On Friday 10 April 2015 11:56:37 André Somers wrote:
> > [...]
> > 
> >> Interesting approach. What's the benefit over using a class inheriting
> >> from the template as QStringList does?
> > 
> > [...]
> > 
> > For one, you're not supoosed to inherit from value classes. For another...
> > Oh, I think that's enough reasons :)
> 
> That a religious argument instead of a technical one.
> 
> It was meant as a serious question. It looks to me like the chosen
> alternative is more complex than what was there before, especially in
> tricking the user to think that it actually _is_ a class. So again: what
> is the benefit of a change like this?

If you have a 

 template<typename T> QList<T> returnAListOfThings();

You can do

  returnAListOfThings<QString>().join("*");

For example, now, QStringList::fromVector(QVector<QString>()) returns a 
QList<QString> which is not a QStringList (So you can't directly call special 
method. And when you assign it to a QStringList, it cannot be moved)
  

-- 
Olivier

Woboq - Qt services and support - http://woboq.com







More information about the Development mailing list