Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2015, 10:47:51 PM (9 years ago)
Author:
landauf
Message:

use range-based for-loop where it makes sense (e.g. ObjectList)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/ClassTreeMask.cc

    r10916 r10919  
    915915
    916916            // Iterate through all subnodes
    917             for (std::list<ClassTreeMaskNode*>::iterator it1 = node->subnodes_.begin(); it1 != node->subnodes_.end(); ++it1)
     917            for (ClassTreeMaskNode* subnode : node->subnodes_)
    918918            {
    919919                // Recursive call to this function with the subnode
    920                 this->create(*it1);
     920                this->create(subnode);
    921921
    922922                // Only execute the following code if the current node is included, meaning some of the subnodes might be included too
     
    926926
    927927                    // Iterate through all direct children
    928                     for (std::set<const Identifier*>::iterator it2 = directChildren.begin(); it2 != directChildren.end(); ++it2)
     928                    for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it)
    929929                    {
    930930                        // Check if the subnode (it1) is a child of the directChild (it2)
    931                         if ((*it1)->getClass()->isA(*it2))
     931                        if (subnode->getClass()->isA(*it))
    932932                        {
    933933                            // Yes it is - remove the directChild (it2) from the list, because it will already be handled by a recursive call to the create() function
    934                             directChildren.erase(it2);
     934                            directChildren.erase(it);
    935935
    936936                            // Check if the removed directChild was exactly the subnode
    937                             if (!(*it1)->getClass()->isExactlyA(*it2))
     937                            if (!subnode->getClass()->isExactlyA(*it))
    938938                            {
    939939                                // No, it wasn't exactly the subnode - therefore there are some classes between
    940940
    941941                                // Add the previously removed directChild (it2) to the subclass-list
    942                                 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it2, true));
     942                                this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, true));
    943943
    944944                                // Insert all directChildren of the directChild
    945                                 directChildren.insert((*it2)->getDirectChildren().begin(), (*it2)->getDirectChildren().end());
     945                                directChildren.insert((*it)->getDirectChildren().begin(), (*it)->getDirectChildren().end());
    946946
    947947                                // Restart the scan with the expanded set of directChildren
Note: See TracChangeset for help on using the changeset viewer.