, what_str("")
{
#ifdef DEAL_II_HAVE_GLIBC_STACKTRACE
- for (unsigned int i = 0;
- i < sizeof(raw_stacktrace) / sizeof(raw_stacktrace[0]);
- ++i)
- raw_stacktrace[i] = nullptr;
+ std::fill(std::begin(raw_stacktrace), std::end(raw_stacktrace), nullptr);
#endif
}
// by what()
{
#ifdef DEAL_II_HAVE_GLIBC_STACKTRACE
- for (unsigned int i = 0;
- i < sizeof(raw_stacktrace) / sizeof(raw_stacktrace[0]);
- ++i)
- raw_stacktrace[i] = nullptr;
+ std::fill(std::begin(raw_stacktrace), std::end(raw_stacktrace), nullptr);
#endif
}
for (unsigned int d = 0; d < dim + 1; ++d)
Assert(values[d].size() == n, ExcDimensionMismatch(values[d].size(), n));
- for (unsigned int d = 0; d < values.size(); ++d)
- for (unsigned int k = 0; k < values[d].size(); ++k)
- values[d][k] = 0.;
+ for (auto &point_values : values)
+ std::fill(point_values.begin(), point_values.end(), 0.);
}
//----------------------------------------------------------------------//
{
vector_values(points, values);
for (unsigned int d = 0; d < dim; ++d)
- for (unsigned int k = 0; k < values[d].size(); ++k)
- values[d][k] *= -reaction;
+ for (double &point_value : values[d])
+ point_value *= -reaction;
}
else
{
for (unsigned int d = 0; d < dim; ++d)
- for (unsigned int k = 0; k < values[d].size(); ++k)
- values[d][k] = 0.;
+ std::fill(values[d].begin(), values[d].end(), 0.);
}
for (unsigned int d = 0; d < 2 + 1; ++d)
Assert(values[d].size() == n, ExcDimensionMismatch(values[d].size(), n));
- for (unsigned int d = 0; d < values.size(); ++d)
- for (unsigned int k = 0; k < values[d].size(); ++k)
- values[d][k] = 0.;
+ for (auto &point_values : values)
+ std::fill(point_values.begin(), point_values.end(), 0.);
}
}
else
{
- for (unsigned int d = 0; d < values.size(); ++d)
- for (unsigned int k = 0; k < values[d].size(); ++k)
- values[d][k] = 0.;
+ for (auto &point_values : values)
+ std::fill(point_values.begin(), point_values.end(), 0.);
}
}
"erfc",
"rand",
"rand_seed"};
- for (unsigned int f = 0;
- f < sizeof(function_names) / sizeof(function_names[0]);
- ++f)
+ for (const auto &function_name_c_string : function_names)
{
- const std::string function_name = function_names[f];
+ const std::string function_name = function_name_c_string;
const unsigned int function_name_length = function_name.size();
std::string::size_type pos = 0;
indices.clear();
indices.reserve(n_elements());
- for (std::vector<Range>::iterator it = ranges.begin(); it != ranges.end();
- ++it)
- for (size_type i = it->begin; i < it->end; ++i)
- indices.push_back(i);
+ for (const auto &range : ranges)
+ for (size_type entry = range.begin; entry < range.end; ++entry)
+ indices.push_back(entry);
Assert(indices.size() == n_elements(), ExcInternalError());
}
const unsigned int myid = Utilities::MPI::this_mpi_process(mpi_comm);
const unsigned int n_procs = Utilities::MPI::n_mpi_processes(mpi_comm);
- for (unsigned int i = 0; i < destinations.size(); ++i)
+ for (const unsigned int destination : destinations)
{
- Assert(destinations[i] < n_procs,
- ExcIndexRange(destinations[i], 0, n_procs));
- Assert(destinations[i] != myid,
+ (void)destination;
+ Assert(destination < n_procs, ExcIndexRange(destination, 0, n_procs));
+ Assert(destination != myid,
ExcMessage(
"There is no point in communicating with ourselves."));
}
{
const unsigned int n_procs = Utilities::MPI::n_mpi_processes(mpi_comm);
- for (unsigned int i = 0; i < destinations.size(); ++i)
+ for (const unsigned int destination : destinations)
{
- Assert(destinations[i] < n_procs,
- ExcIndexRange(destinations[i], 0, n_procs));
- Assert(destinations[i] != Utilities::MPI::this_mpi_process(mpi_comm),
+ (void)destination;
+ Assert(destination < n_procs, ExcIndexRange(destination, 0, n_procs));
+ Assert(destination != Utilities::MPI::this_mpi_process(mpi_comm),
ExcMessage(
"There is no point in communicating with ourselves."));
}
void
ParameterAcceptor::parse_all_parameters(ParameterHandler &prm)
{
- for (unsigned int i = 0; i < class_list.size(); ++i)
- if (class_list[i] != nullptr)
+ for (const auto &instance : class_list)
+ if (instance != nullptr)
{
- class_list[i]->enter_my_subsection(prm);
- class_list[i]->parse_parameters(prm);
- class_list[i]->parse_parameters_call_back();
- class_list[i]->leave_my_subsection(prm);
+ instance->enter_my_subsection(prm);
+ instance->parse_parameters(prm);
+ instance->parse_parameters_call_back();
+ instance->leave_my_subsection(prm);
}
}
void
ParameterAcceptor::declare_all_parameters(ParameterHandler &prm)
{
- for (unsigned int i = 0; i < class_list.size(); ++i)
- if (class_list[i] != nullptr)
+ for (const auto &instance : class_list)
+ if (instance != nullptr)
{
- class_list[i]->enter_my_subsection(prm);
- class_list[i]->declare_parameters(prm);
- class_list[i]->declare_parameters_call_back();
- class_list[i]->leave_my_subsection(prm);
+ instance->enter_my_subsection(prm);
+ instance->declare_parameters(prm);
+ instance->declare_parameters_call_back();
+ instance->leave_my_subsection(prm);
}
}
// see if the name is special and if so mangle the whole thing
const bool mangle_whole_string = (s == "value");
- // for all parts of the string, see
- // if it is an allowed character or
- // not
- for (unsigned int i = 0; i < s.size(); ++i)
+ // for all parts of the string, see if it is an allowed character or not
+ for (const char c : s)
{
static const std::string allowed_characters(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
if ((!mangle_whole_string) &&
- (allowed_characters.find(s[i]) != std::string::npos))
- u.push_back(s[i]);
+ (allowed_characters.find(c) != std::string::npos))
+ u.push_back(c);
else
{
u.push_back('_');
'd',
'e',
'f'};
- u.push_back(hex[static_cast<unsigned char>(s[i]) / 16]);
- u.push_back(hex[static_cast<unsigned char>(s[i]) % 16]);
+ u.push_back(hex[static_cast<unsigned char>(c) / 16]);
+ u.push_back(hex[static_cast<unsigned char>(c) % 16]);
}
}
{
std::vector<int> action_indices = Utilities::string_to_int(
Utilities::split_string_list(action_indices_as_string.get()));
- for (unsigned int index : action_indices)
+ for (const unsigned int index : action_indices)
if (actions.size() >= index + 1)
actions[index](new_value);
}
p->second.get<std::string>("documentation"),
78 - overall_indent_level * 2 - 2);
- for (unsigned int i = 0; i < doc_lines.size(); ++i)
+ for (const auto &doc_line : doc_lines)
out << std::setw(overall_indent_level * 2) << ""
- << "# " << doc_lines[i] << '\n';
+ << "# " << doc_line << '\n';
}
{
// create label: labels are not to be escaped but mangled
std::string label = "parameters:";
- for (unsigned int i = 0;
- i < target_subsection_path.size();
- ++i)
+ for (const auto &path : target_subsection_path)
{
- label.append(mangle(target_subsection_path[i]));
+ label.append(mangle(path));
label.append("/");
}
label.append(p->first);
out << "\\index[prmindex]{" << escape(demangle(p->first))
<< "}\n";
out << "\\index[prmindexfull]{";
- for (unsigned int i = 0; i < target_subsection_path.size();
- ++i)
- out << escape(target_subsection_path[i]) << "!";
+ for (const auto &path : target_subsection_path)
+ out << escape(path) << "!";
out << escape(demangle(p->first)) << "}\n";
// finally print value and default
{
// create label: labels are not to be escaped but mangled
std::string label = "parameters:";
- for (unsigned int i = 0;
- i < target_subsection_path.size();
- ++i)
+ for (const auto &path : target_subsection_path)
{
- label.append(mangle(target_subsection_path[i]));
+ label.append(mangle(path));
label.append("/");
}
label.append(p->first);
out << "\\index[prmindex]{" << escape(demangle(p->first))
<< "}\n";
out << "\\index[prmindexfull]{";
- for (unsigned int i = 0; i < target_subsection_path.size();
- ++i)
- out << escape(target_subsection_path[i]) << "!";
+ for (const auto &path : target_subsection_path)
+ out << escape(path) << "!";
out << escape(demangle(p->first)) << "}\n";
// finally print alias and indicate if it is deprecated
if (description_str.size() > 1)
{
out << '\n';
- for (unsigned int i = 0; i < description_str.size(); ++i)
+ for (const auto &description : description_str)
out << std::setw(overall_indent_level * 2 + 6) << ""
- << description_str[i] << '\n';
+ << description << '\n';
}
else if (description_str.empty() == false)
out << " " << description_str[0] << '\n';
// find the path to the current section so that we can
// print it in the \subsection{...} heading
- for (unsigned int i = 0; i < target_subsection_path.size(); ++i)
- out << escape(target_subsection_path[i]) << "/";
+ for (const auto &path : target_subsection_path)
+ out << escape(path) << "/";
out << escape(demangle(p->first));
out << "}" << '\n';
out << "\\label{parameters:";
- for (unsigned int i = 0; i < target_subsection_path.size(); ++i)
- out << mangle(target_subsection_path[i]) << "/";
+ for (const auto &path : target_subsection_path)
+ out << mangle(path) << "/";
out << p->first << "}";
out << '\n';
{
// if there are top level elements to print, do it
if (include_top_level_elements && (subsection_path.size() > 0))
- for (unsigned int i = 0; i < subsection_path.size(); ++i)
+ for (const auto &path : subsection_path)
{
out << std::setw(overall_indent_level * 2) << ""
- << "subsection " << demangle(subsection_path[i])
- << std::endl;
+ << "subsection " << demangle(path) << std::endl;
overall_indent_level += 1;
}
p->second.get<std::string>("documentation"),
78 - overall_indent_level * 2 - 2);
- for (unsigned int i = 0; i < doc_lines.size(); ++i)
+ for (const auto &doc_line : doc_lines)
out << std::setw(overall_indent_level * 2) << ""
- << "# " << doc_lines[i] << std::endl;
+ << "# " << doc_line << std::endl;
}
out << "\\item {\\it Parameter name:} {\\tt "
<< escape(demangle(p->first)) << "}\n"
<< "\\phantomsection\\label{parameters:";
- for (unsigned int i = 0; i < subsection_path.size(); ++i)
- out << mangle(subsection_path[i]) << "/";
+ for (const auto &path : subsection_path)
+ out << mangle(path) << "/";
out << p->first;
out << "}\n\n" << std::endl;
out << "\\index[prmindex]{" << escape(demangle(p->first))
<< "}\n";
out << "\\index[prmindexfull]{";
- for (unsigned int i = 0; i < subsection_path.size(); ++i)
- out << escape(subsection_path[i]) << "!";
+ for (const auto &path : subsection_path)
+ out << escape(path) << "!";
out << escape(demangle(p->first)) << "}\n";
// finally print value and default
out << "\\item {\\it Parameter name:} {\\tt "
<< escape(demangle(p->first)) << "}\n"
<< "\\phantomsection\\label{parameters:";
- for (unsigned int i = 0; i < subsection_path.size(); ++i)
- out << mangle(subsection_path[i]) << "/";
+ for (const auto &path : subsection_path)
+ out << mangle(path) << "/";
out << p->first;
out << "}\n\n" << std::endl;
out << "\\index[prmindex]{" << escape(demangle(p->first))
<< "}\n";
out << "\\index[prmindexfull]{";
- for (unsigned int i = 0; i < subsection_path.size(); ++i)
- out << escape(subsection_path[i]) << "!";
+ for (const auto &path : subsection_path)
+ out << escape(path) << "!";
out << escape(demangle(p->first)) << "}\n";
// finally print alias and indicate if it is deprecated
{
// if there are top level elements to print, do it
if (include_top_level_elements && (subsection_path.size() > 0))
- for (unsigned int i = 0; i < subsection_path.size(); ++i)
+ for (const auto &path : subsection_path)
{
out << std::setw(overall_indent_level * 2) << ""
- << "subsection " << demangle(subsection_path[i])
- << std::endl;
+ << "subsection " << demangle(path) << std::endl;
overall_indent_level += 1;
};
if (description_str.size() > 1)
{
out << std::endl;
- for (unsigned int i = 0; i < description_str.size(); ++i)
+ for (const auto &description : description_str)
out << std::setw(overall_indent_level * 2 + 6) << ""
- << description_str[i] << std::endl;
+ << description << std::endl;
}
else if (description_str.empty() == false)
out << " " << description_str[0] << std::endl;
// find the path to the current section so that we can
// print it in the \subsection{...} heading
- for (unsigned int i = 0; i < subsection_path.size(); ++i)
- out << escape(subsection_path[i]) << "/";
+ for (const auto &path : subsection_path)
+ out << escape(path) << "/";
out << escape(demangle(p->first));
out << "}" << std::endl;
out << "\\label{parameters:";
- for (unsigned int i = 0; i < subsection_path.size(); ++i)
- out << mangle(subsection_path[i]) << "/";
+ for (const auto &path : subsection_path)
+ out << mangle(path) << "/";
out << p->first << "}";
out << std::endl;
std::vector<int> action_indices =
Utilities::string_to_int(Utilities::split_string_list(
action_indices_as_string.get()));
- for (unsigned int index : action_indices)
+ for (const unsigned int index : action_indices)
if (actions.size() >= index + 1)
actions[index](entry_value);
}
init_branches_current_section();
// split up different values
- for (unsigned int i = 0; i < multiple_choices.size(); ++i)
- multiple_choices[i].split_different_values();
+ for (auto &multiple_choice : multiple_choices)
+ multiple_choice.split_different_values();
// finally calculate number of branches
n_branches = 1;
- for (unsigned int i = 0; i < multiple_choices.size(); ++i)
- if (multiple_choices[i].type == Entry::variant)
- n_branches *= multiple_choices[i].different_values.size();
+ for (const auto &multiple_choice : multiple_choices)
+ if (multiple_choice.type == Entry::variant)
+ n_branches *= multiple_choice.different_values.size();
// check whether array entries have the correct
// number of entries
- for (unsigned int i = 0; i < multiple_choices.size(); ++i)
- if (multiple_choices[i].type == Entry::array)
- if (multiple_choices[i].different_values.size() != n_branches)
+ for (const auto &multiple_choice : multiple_choices)
+ if (multiple_choice.type == Entry::array)
+ if (multiple_choice.different_values.size() != n_branches)
std::cerr << " The entry value" << std::endl
- << " " << multiple_choices[i].entry_value << std::endl
+ << " " << multiple_choice.entry_value << std::endl
<< " for the entry named" << std::endl
- << " " << multiple_choices[i].entry_name << std::endl
+ << " " << multiple_choice.entry_name << std::endl
<< " does not have the right number of entries for the "
<< std::endl
<< " " << n_branches
MultipleParameterLoop::memory_consumption() const
{
std::size_t mem = ParameterHandler::memory_consumption();
- for (unsigned int i = 0; i < multiple_choices.size(); ++i)
- mem += multiple_choices[i].memory_consumption();
+ for (const auto &multiple_choice : multiple_choices)
+ mem += multiple_choice.memory_consumption();
return mem;
}
std::vector<std::string> const_list =
Utilities::split_string_list(constants_list, ',');
std::map<std::string, double> constants;
- for (unsigned int i = 0; i < const_list.size(); ++i)
+ for (const auto &constant : const_list)
{
std::vector<std::string> this_c =
- Utilities::split_string_list(const_list[i], '=');
+ Utilities::split_string_list(constant, '=');
AssertThrow(this_c.size() == 2, ExcMessage("Invalid format"));
double tmp;
AssertThrow(std::sscanf(this_c[1].c_str(), "%lf", &tmp),
# ifdef DEBUG
const types::global_dof_index n_local_dofs =
local_range_data.second - local_range_data.first;
- for (unsigned int i = 0; i < import_indices_data.size(); ++i)
+ for (const auto &range : import_indices_data)
{
- AssertIndexRange(import_indices_data[i].first, n_local_dofs);
- AssertIndexRange(import_indices_data[i].second - 1, n_local_dofs);
+ AssertIndexRange(range.first, n_local_dofs);
+ AssertIndexRange(range.second - 1, n_local_dofs);
}
# endif
}
// first translate tight ghost indices into indices within the large
// set:
std::vector<unsigned int> expanded_numbering;
- for (IndexSet::ElementIterator it = ghost_indices_data.begin();
- it != ghost_indices_data.end();
- ++it)
+ for (dealii::IndexSet::size_type index : ghost_indices_data)
{
- Assert(larger_ghost_index_set.is_element(*it),
+ Assert(larger_ghost_index_set.is_element(index),
ExcMessage("The given larger ghost index set must contain"
"all indices in the actual index set."));
Assert(
- larger_ghost_index_set.index_within_set(*it) <
+ larger_ghost_index_set.index_within_set(index) <
static_cast<types::global_dof_index>(
std::numeric_limits<unsigned int>::max()),
ExcMessage(
"Index overflow: This class supports at most 2^32-1 ghost elements"));
expanded_numbering.push_back(
- larger_ghost_index_set.index_within_set(*it));
+ larger_ghost_index_set.index_within_set(index));
}
// now rework expanded_numbering into ranges and store in:
{
std::string u;
u.reserve(input.size());
- for (auto c : input)
+ for (const auto c : input)
{
switch (c)
{
(split_list.size() > max_elements))
return false;
- for (auto &key_value_pair : split_list)
+ for (const auto &key_value_pair : split_list)
{
std::vector<std::string> pair =
Utilities::split_string_list(key_value_pair, key_value_separator);
coefficients[k] = b * coefficients_km1[k - 1];
coefficients[k - 1] = b * coefficients_km1[k - 2];
- for (unsigned int i = 0; i < coefficients.size(); i++)
+ for (double &coefficient : coefficients)
{
- coefficients[i] *= a;
+ coefficient *= a;
}
return coefficients;
{
std::vector<Polynomial<double>> p_base =
LagrangeEquidistant::generate_complete_basis(base_degree);
- for (unsigned int i = 0; i < p_base.size(); ++i)
- p_base[i].scale(n_subdivisions);
+ for (auto &polynomial : p_base)
+ polynomial.scale(n_subdivisions);
std::vector<PiecewisePolynomial<double>> p;
p.reserve(n_subdivisions * base_degree + 1);
// mutations of a face (mutation==0
// corresponds to a face with standard
// orientation, no flip and no rotation)
- for (unsigned int mutation = 0; mutation < 8; ++mutation)
+ for (const auto &mutation : q)
{
// project to each face and append
// results
for (unsigned int face = 0; face < n_faces; ++face)
{
- project_to_face(q[mutation], face, help);
+ project_to_face(mutation, face, help);
std::copy(help.begin(), help.end(), std::back_inserter(q_points));
}
// next copy over weights
for (unsigned int face = 0; face < n_faces; ++face)
- std::copy(q[mutation].get_weights().begin(),
- q[mutation].get_weights().end(),
+ std::copy(mutation.get_weights().begin(),
+ mutation.get_weights().end(),
std::back_inserter(weights));
}
// mutations of a face (mutation==0
// corresponds to a face with standard
// orientation, no flip and no rotation)
- for (unsigned int mutation = 0; mutation < 8; ++mutation)
+ for (const auto &mutation : q)
{
// project to each face and copy
// results
RefinementCase<dim - 1>(ref_case));
++subface)
{
- project_to_subface(q[mutation],
+ project_to_subface(mutation,
face,
subface,
help,
subface < GeometryInfo<dim - 1>::n_children(
RefinementCase<dim - 1>(ref_case));
++subface)
- std::copy(q[mutation].get_weights().begin(),
- q[mutation].get_weights().end(),
+ std::copy(mutation.get_weights().begin(),
+ mutation.get_weights().end(),
std::back_inserter(weights));
}
: counter(0)
, object_info(subscriptor.object_info)
{
- for (auto validity_ptr : subscriptor.validity_pointers)
+ for (const auto validity_ptr : subscriptor.validity_pointers)
*validity_ptr = false;
}
Subscriptor::~Subscriptor()
{
- for (auto validity_ptr : validity_pointers)
+ for (const auto validity_ptr : validity_pointers)
*validity_ptr = false;
object_info = nullptr;
}
if (std::uncaught_exception() == false)
{
std::string infostring;
- for (map_iterator it = counter_map.begin(); it != counter_map.end();
- ++it)
+ for (const auto &map_entry : counter_map)
{
- if (it->second > 0)
- infostring +=
- std::string("\n from Subscriber ") + std::string(it->first);
+ if (map_entry.second > 0)
+ infostring += std::string("\n from Subscriber ") +
+ std::string(map_entry.first);
}
if (infostring == "")
Subscriptor &
Subscriptor::operator=(Subscriptor &&s) noexcept
{
- for (auto validity_ptr : s.validity_pointers)
+ for (const auto validity_ptr : s.validity_pointers)
*validity_ptr = false;
object_info = s.object_info;
return *this;
{
max_length = 0;
- for (std::vector<dealii::internal::TableEntry>::iterator it = entries.begin();
- it != entries.end();
- ++it)
+ for (const auto &entry : entries)
{
- it->cache_string(this->scientific, this->precision);
+ entry.cache_string(this->scientific, this->precision);
max_length =
std::max(max_length,
- static_cast<unsigned int>(it->get_cached_string().length()));
+ static_cast<unsigned int>(entry.get_cached_string().length()));
}
}
{
// figure out the longest current column
unsigned int max_col_length = 0;
- for (std::map<std::string, Column>::iterator p = columns.begin();
- p != columns.end();
- ++p)
+ for (const auto &column : columns)
max_col_length =
std::max(max_col_length,
- static_cast<unsigned int>(p->second.entries.size()));
+ static_cast<unsigned int>(column.second.entries.size()));
// then pad all columns to that length with empty strings
- for (std::map<std::string, Column>::iterator col = columns.begin();
- col != columns.end();
- ++col)
- while (col->second.entries.size() < max_col_length)
+ for (auto &column : columns)
+ while (column.second.entries.size() < max_col_length)
{
- col->second.entries.emplace_back("");
- internal::TableEntry &entry = col->second.entries.back();
- entry.cache_string(col->second.scientific, col->second.precision);
- col->second.max_length =
- std::max(col->second.max_length,
+ column.second.entries.emplace_back("");
+ internal::TableEntry &entry = column.second.entries.back();
+ entry.cache_string(column.second.scientific, column.second.precision);
+ column.second.max_length =
+ std::max(column.second.max_length,
static_cast<unsigned int>(
entry.get_cached_string().length()));
}
supercolumns.insert(new_column);
// replace key in column_order
// by superkey
- for (unsigned int j = 0; j < column_order.size(); ++j)
- if (column_order[j] == key)
+ for (auto &column : column_order)
+ if (column == key)
{
- column_order[j] = superkey;
+ column = superkey;
break;
}
}
else
{
// remove key from column_order
- // for erase we need an iterator
- for (std::vector<std::string>::iterator order_iter = column_order.begin();
- order_iter != column_order.end();
- ++order_iter)
- if (*order_iter == key)
- {
- column_order.erase(order_iter);
- break;
- }
+ const auto order_iter =
+ std::find(column_order.begin(), column_order.end(), key);
+ if (order_iter != column_order.end())
+ column_order.erase(order_iter);
}
if (supercolumns.count(superkey))
void
TableHandler::set_column_order(const std::vector<std::string> &new_order)
{
- for (unsigned int j = 0; j < new_order.size(); ++j)
- Assert(supercolumns.count(new_order[j]) || columns.count(new_order[j]),
- ExcColumnOrSuperColumnNotExistent(new_order[j]));
+ for (const auto &new_column : new_order)
+ {
+ (void)new_column;
+ Assert(supercolumns.count(new_column) || columns.count(new_column),
+ ExcColumnOrSuperColumnNotExistent(new_column));
+ }
column_order = new_order;
}
++p)
max_rows = std::max<unsigned int>(max_rows, p->second.entries.size());
- for (std::map<std::string, Column>::iterator p = columns.begin();
- p != columns.end();
- ++p)
- p->second.pad_column_below(max_rows);
+ for (auto &column : columns)
+ column.second.pad_column_below(max_rows);
}
std::vector<std::string> sel_columns;
{
// This format output supercolumn headers and aligns them centered
// over all the columns that belong to it.
- for (unsigned int j = 0; j < column_order.size(); ++j)
+ for (const auto &key : column_order)
{
- const std::string &key = column_order[j];
- unsigned int width = 0;
+ unsigned int width = 0;
{
// compute the width of this column or supercolumn
const std::map<std::string,
++p)
max_rows = std::max<unsigned int>(max_rows, p->second.entries.size());
- for (std::map<std::string, Column>::iterator p = columns.begin();
- p != columns.end();
- ++p)
- p->second.pad_column_below(max_rows);
+ for (auto &column : columns)
+ column.second.pad_column_below(max_rows);
}
std::vector<std::string> sel_columns;
get_selected_columns(sel_columns);
// write the column formats
- for (unsigned int j = 0; j < column_order.size(); ++j)
+ for (const auto &key : column_order)
{
- std::string key = column_order[j];
// avoid `supercolumns[key]'
const std::map<std::string, std::vector<std::string>>::const_iterator
super_iter = supercolumns.find(key);
{
sel_columns.clear();
- for (unsigned int j = 0; j < column_order.size(); ++j)
+ for (const auto &key : column_order)
{
- std::string key = column_order[j];
const std::map<std::string, std::vector<std::string>>::const_iterator
super_iter = supercolumns.find(key);
// Figure out what is the correct (max) length of the columns
// so that we "shave" one off.
std::vector<internal::TableEntry>::size_type n = 0;
- for (std::map<std::string, Column>::iterator p = columns.begin();
- p != columns.end();
- ++p)
- n = std::max(n, p->second.entries.size());
+ for (const auto &column : columns)
+ n = std::max(n, column.second.entries.size());
// shave the top most element
if (n != 0)
- for (std::map<std::string, Column>::iterator p = columns.begin();
- p != columns.end();
- ++p)
- if (p->second.entries.size() == n)
- p->second.entries.pop_back();
+ for (auto &column : columns)
+ if (column.second.entries.size() == n)
+ column.second.entries.pop_back();
}