Use C++11 for loop

Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
This commit is contained in:
Allan Odgaard
2014-03-02 22:57:05 +07:00
parent 1781f4a605
commit c2397484b8
126 changed files with 1585 additions and 1585 deletions

View File

@@ -17,14 +17,14 @@ namespace
std::lock_guard<std::mutex> lock(_lock);
std::vector<int> toDelete;
iterate(record, _records)
for(auto const& record : _records)
{
if(record->second.done && record->second.stop)
toDelete.push_back(record->first);
if(record.second.done && record.second.stop)
toDelete.push_back(record.first);
}
iterate(key, toDelete)
_records.erase(*key);
for(auto const& key : toDelete)
_records.erase(key);
return _records.emplace(_next_key++, (record_t){ processId, std::string(), false, nil, false }).first->first;
}