Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2015, 11:22:03 PM (8 years ago)
Author:
landauf
Message:

use actual types instead of 'auto'. only exception is for complicated template types, e.g. when iterating over a map

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/util/StringUtils.cc

    r10821 r10916  
    262262        std::string output(str.size() * 2, ' ');
    263263        size_t i = 0;
    264         for (auto & elem : str)
    265         {
    266             switch (elem)
     264        for (const char& character : str)
     265        {
     266            switch (character)
    267267            {
    268268            case '\\': output[i] = '\\'; output[i + 1] = '\\'; break;
     
    276276            case  '"': output[i] = '\\'; output[i + 1] =  '"'; break;
    277277            case '\0': output[i] = '\\'; output[i + 1] =  '0'; break;
    278             default  : output[i] = elem; ++i; continue;
     278            default  : output[i] = character; ++i; continue;
    279279            }
    280280            i += 2;
     
    336336    void lowercase(std::string* str)
    337337    {
    338         for (auto & elem : *str)
    339         {
    340             elem = static_cast<char>(tolower(elem));
     338        for (char& character : *str)
     339        {
     340            character = static_cast<char>(tolower(character));
    341341        }
    342342    }
     
    353353    void uppercase(std::string* str)
    354354    {
    355         for (auto & elem : *str)
    356         {
    357             elem = static_cast<char>(toupper(elem));
     355        for (char& character : *str)
     356        {
     357            character = static_cast<char>(toupper(character));
    358358        }
    359359    }
     
    460460    {
    461461        size_t j = 0;
    462         for (auto & elem : str)
    463         {
    464             if (elem == target)
     462        for (char& character : str)
     463        {
     464            if (character == target)
    465465            {
    466                 elem = replacement;
     466                character = replacement;
    467467                ++j;
    468468            }
Note: See TracChangeset for help on using the changeset viewer.