foreach is obsolete
Details
Details
- Reviewers
aacid - Group Reviewers
KDE Edu - Commits
- R334:c887b11d3a1f: Remove foreach in KmPlot in favor of range-based loops
- Compile, install, run.
- Create some plot (sin(x)), save it, export it, close it, load it.
- Use equation editor.
Diff Detail
Diff Detail
- Repository
- R334 KmPlot
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Comment Actions
There's some more other lists that maybe are not const, not sure if we care a lot though, but it's always too have "the best code possible"
Up to you if you want to change it or not
kmplot/equationhighlighter.cpp | ||
---|---|---|
71–72 | mark variables and functions as const? | |
kmplot/function.cpp | ||
390 | what would you think of const QStringList listSplit = ( (p1 != -1) && (p2 != -1) ) ? m_fstr.mid( p1+1, p2-p1-1 ).split( ',', QString::SkipEmptyParts ) : {}; | |
620 | qDeleteAll? | |
832 | qAsConst? | |
849 | qAsConst? | |
879 | qAsConst? | |
895 | qAsConst? | |
kmplot/functioneditor.cpp | ||
126 | qAsConst? | |
233 | qAsConst? | |
729 | qAsConst? |
Comment Actions
In general the only problem in porting forach to for( : ) is when the list was modified inside foreach since forach made a "copy-on-write" and for doesn't.
I don't see any such case here so let's hope it's good.