Skip to content

Commit

Permalink
opt: remove code smell
Browse files Browse the repository at this point in the history
for loop should avoid change the iterators
  • Loading branch information
xiaoyifang committed Aug 10, 2024
1 parent c29698e commit 0fedfba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/article_maker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ sptr< Dictionary::DataRequest > ArticleMaker::makeDefinitionFor( QString const &
std::vector< sptr< Dictionary::Class > > dicts;

// Find dictionaries by ID's
for ( QStringList::Iterator it = dictIDs.begin(); it != dictIDs.end(); ++it ) {
for ( const auto & dictId : dictIDs ) {
for ( unsigned x = 0; x < dictionaries.size(); x++ ) {
if ( *it == QString::fromStdString( dictionaries[ x ]->getId() ) ) {
if ( dictId == QString::fromStdString( dictionaries[ x ]->getId() ) ) {
dicts.push_back( dictionaries[ x ] );
break;
}
Expand Down

0 comments on commit 0fedfba

Please sign in to comment.