It (should) simplify code a bit. It some cases prevents copying strings, shared_ptrs.
Details
Diff Detail
- Repository
- R40 Kate
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
I think if we touch all this, we should use in some places qAsConst (or const ... local variable) to avoid detach, see more detailed explanation here:
https://www.kdab.com/goodbye-q_foreach/
(that howto is for a different kind of conversion but the hints for qAsConst are ok for this, too)
e.g.
QStringList children = config.readEntry("Children", QStringList());
for (const auto& str : children) {
>
const QStringList children = config.readEntry("Children", QStringList());
for (const auto& str : children) {
or
for (auto& pluginInfo : m_pluginList) {
>
for (auto& pluginInfo : qAsConst(m_pluginList)) {
qAsConst has problems if we want to take addr to object:
for (auto& pluginInfo : qAsConst(m_pluginList)) { m_name2Plugin[pluginInfo.saveName()] = &pluginInfo; }
&pluginInfo will be const ptr.
I actually prefer to keep the author intact to attribute the work properly.
I mean: you did contribute, you shall be mentioned in the log :/
Anyways, thanks for the improvements, the new range based loops are a good thing to use.