loh.tar added inline comments. INLINE COMMENTS
> davidedmundson wrote in loader.cpp:273 > > Probably, yes. But Qt docu always says, "thanks to implicit sharing copying > > a container is very fast" > > That's mixing up docs. > > foreach() always does a const copy of the list. This is a cheap implicitly > shared copy. > when we loop we're never detaching this list because it's const. > > for() does not > So when we loop if we call begin() we might get the non-const version. If > this list is used elsewhere that means we detach and that causes a deep-copy. > This is expensive. > > In this specific case language() returns a new QStringList (.keys() generates > a new list) so I /think/ it is fine, > > but it's definitely ambiguous. A qAsConst would make sense here. > A qAsConst would make sense here. In which way? This is not working: for (const QString &langCode : qAsConst(languages())) So you like to see this? const QStringList constLanguages = languages(); for (const QString &langCode : constLanguages) { REPOSITORY R246 Sonnet REVISION DETAIL https://phabricator.kde.org/D17028 To: loh.tar, davidedmundson Cc: smartins, kde-frameworks-devel, michaelh, ngraham, bruns