#include <deal.II/base/config.h>
+#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
{
if (all_true)
return true;
- for (std::vector<bool>::const_iterator i = flags.begin(); i != flags.end();
- ++i)
- if (*i)
- return true;
- return false;
+ return std::find(flags.begin(), flags.end(), true) != flags.end();
}
// Test all flags separately
// and return false if one is
// not set
- for (std::vector<bool>::const_iterator i = flags.begin();
- i != flags.end();
- ++i)
- if (!*i)
- return false;
- // All flags are set
- return true;
+ return std::find(flags.begin(), flags.end(), false) == flags.end();
}
// Finally, compare each flag
all_true = false;
if (event.all_true)
{
- for (std::vector<bool>::iterator i = flags.begin(); i != flags.end();
- ++i)
- *i = false;
+ std::fill(flags.begin(), flags.end(), false);
return *this;
}
// linked to current_vertex is already using the color j, this
// color cannot be used anymore.
bool unused_color(true);
- for (unsigned int k = 0; k < graph[current_vertex].size(); ++k)
- if (colors_used[j].count(graph[current_vertex][k]) == 1)
+ for (const auto adjacent_vertex : graph[current_vertex])
+ if (colors_used[j].count(adjacent_vertex) == 1)
{
unused_color = false;
break;
* Constructor. @p string_name is the name of the HDF5 Object. If @p mpi is
* True then MPI I/O is used.
*/
- HDF5Object(const std::string name, const bool mpi);
+ HDF5Object(const std::string &name, const bool mpi);
public:
/**
* Create dataset. This is an internal constructor. The function
* Group::create_dataset() should be used to create a dataset.
*/
- DataSet(const std::string & name,
- const hid_t & parent_group_id,
- const std::vector<hsize_t> &dimensions,
- std::shared_ptr<hid_t> t_type,
- const bool mpi);
+ DataSet(const std::string & name,
+ const hid_t & parent_group_id,
+ const std::vector<hsize_t> & dimensions,
+ const std::shared_ptr<hid_t> &t_type,
+ const bool mpi);
public:
/**
#ifdef DEBUG
size_type s = 0;
- for (std::vector<Range>::iterator range = ranges.begin();
- range != ranges.end();
- ++range)
- s += (range->end - range->begin);
+ for (const auto &range : ranges)
+ s += (range.end - range.begin);
Assert(s == v, ExcInternalError());
#endif
// then write ones into the elements whose indices are contained in the
// index set
- for (std::vector<Range>::iterator it = ranges.begin(); it != ranges.end();
- ++it)
- for (size_type i = it->begin; i < it->end; ++i)
+ for (const auto &range : ranges)
+ for (size_type i = range.begin; i < range.end; ++i)
vector[i] = 1;
}
std::vector<std::string> descriptions;
- for (unsigned int j = 0; j < patterns.size(); ++j)
- descriptions.push_back(patterns[j]->description());
+ for (const auto &pattern : patterns)
+ descriptions.push_back(pattern->description());
ar &descriptions;
}
ar & descriptions;
patterns.clear();
- for (unsigned int j = 0; j < descriptions.size(); ++j)
- patterns.push_back(Patterns::pattern_factory(descriptions[j]));
+ for (const auto &description : descriptions)
+ patterns.push_back(Patterns::pattern_factory(description));
}
unsigned int offset =
n_ghost_indices_in_larger_set - n_ghost_indices();
// must copy ghost data into extended ghost array
- for (const auto ghost_range : ghost_indices_subset_data)
+ for (const auto &ghost_range : ghost_indices_subset_data)
{
if (offset > ghost_range.first)
{
{
out << "DEAL_II_" << cls << "PATH=\"";
bool first = true;
- for (std::vector<std::string>::iterator p = my_path_list.begin();
- p != my_path_list.end();
- ++p)
+ for (const auto &p : my_path_list)
{
if (!first)
out << ':';
- out << *p;
+ out << p;
first = false;
}
out << '"' << std::endl << " Suffixes";
- for (std::vector<std::string>::iterator s = my_suffix_list.begin();
- s != my_suffix_list.end();
- ++s)
- out << " \"" << *s << '"';
+ for (const auto &s : my_suffix_list)
+ out << " \"" << s << '"';
out << std::endl;
}
static_assert(sizeof...(ps) > 0,
"The number of PatternTypes must be greater than zero!");
auto pattern_pointers = {(static_cast<const PatternBase *>(&ps))...};
- for (auto p : pattern_pointers)
+ for (const auto p : pattern_pointers)
patterns.push_back(p->clone());
}
std::vector<std::string> vec(t.size());
unsigned int i = 0;
- for (const auto &ti : t)
- vec[i++] = Convert<typename T::value_type>::to_string(ti, base_p);
+ for (const auto entry : t)
+ vec[i++] = Convert<typename T::value_type>::to_string(entry, base_p);
std::string s;
if (vec.size() > 0)
{
std::lock_guard<std::mutex> lock(mutex);
- for (map_iterator it = counter_map.begin(); it != counter_map.end(); ++it)
- stream << it->second << '/' << counter << " subscriptions from \""
- << it->first << '\"' << std::endl;
+ for (const auto &it : counter_map)
+ stream << it.second << '/' << counter << " subscriptions from \""
+ << it.first << '\"' << std::endl;
}
DEAL_II_NAMESPACE_CLOSE
// follow the algorithm given in the introduction to this class
// of padding columns as necessary
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()));
while (columns[key].entries.size() + 1 < max_col_length)
{