Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
File:
1 edited

Legend:

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

    r10768 r10821  
    5353    {
    5454        if (this->bRoot_)
    55             for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
    56                 delete (*it);
     55            for (auto & elem : this->representingNamespaces_)
     56                delete elem;
    5757    }
    5858
     
    8080            for (unsigned int i = 0; i < tokens.size(); i++)
    8181            {
    82                 for (std::set<NamespaceNode*>::iterator it = this->getNamespace()->representingNamespaces_.begin(); it != this->getNamespace()->representingNamespaces_.end(); ++it)
     82                for (auto & elem : this->getNamespace()->representingNamespaces_)
    8383                {
    84                     std::set<NamespaceNode*> temp = (*it)->getNodeRelative(tokens[i]);
     84                    std::set<NamespaceNode*> temp = elem->getNodeRelative(tokens[i]);
    8585                    this->representingNamespaces_.insert(temp.begin(), temp.end());
    8686                }
     
    9393        if (this->bAutogeneratedFileRootNamespace_)
    9494        {
    95             for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
     95            for (auto & elem : this->representingNamespaces_)
    9696            {
    97                 (*it)->setRoot(true);
    98                 (*it)->setHidden(true);
     97                elem->setRoot(true);
     98                elem->setHidden(true);
    9999            }
    100100        }
     
    114114    bool Namespace::includes(const Namespace* ns) const
    115115    {
    116         for (std::set<NamespaceNode*>::const_iterator it1 = this->representingNamespaces_.begin(); it1 != this->representingNamespaces_.end(); ++it1)
     116        for (const auto & elem1 : this->representingNamespaces_)
    117117        {
    118             for (std::set<NamespaceNode*>::const_iterator it2 = ns->representingNamespaces_.begin(); it2 != ns->representingNamespaces_.end(); ++it2)
     118            for (const auto & elem2 : ns->representingNamespaces_)
    119119            {
    120                 if ((*it1)->includes(*it2))
     120                if (elem1->includes(elem2))
    121121                {
    122122                    if (this->operator_ == "or")
     
    149149
    150150        int i = 0;
    151         for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
     151        for (const auto & elem : this->representingNamespaces_)
    152152        {
    153153            if (i > 0)
    154154                output += " / ";
    155155
    156             output += (*it)->toString();
     156            output += elem->toString();
     157            i++;
    157158        }
    158159
     
    165166
    166167        int i = 0;
    167         for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
     168        for (const auto & elem : this->representingNamespaces_)
    168169        {
    169170            if (i > 0)
    170171                output += '\n';
    171172
    172             output += (*it)->toString(indentation);
     173            output += elem->toString(indentation);
     174            i++;
    173175        }
    174176
Note: See TracChangeset for help on using the changeset viewer.