From: David Wells Date: Sun, 14 Aug 2016 22:57:42 +0000 (-0400) Subject: Prefer ++iterator to iterator++ in loops. X-Git-Tag: v8.5.0-rc1~751^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05c9d73d033fcc3957b2b8bc98b397e790a43886;p=dealii.git Prefer ++iterator to iterator++ in loops. These were caught by cppcheck. --- diff --git a/include/deal.II/fe/fe_series.h b/include/deal.II/fe/fe_series.h index fe4c461c3c..fdb4509aa6 100644 --- a/include/deal.II/fe/fe_series.h +++ b/include/deal.II/fe/fe_series.h @@ -377,7 +377,7 @@ FESeries::process_coefficients(const Table &coefficients, // now go through the map and populate the @p norm_values based on @p norm: for (typename std::map >::const_iterator it = pred_to_values.begin(); - it != pred_to_values.end(); it++) + it != pred_to_values.end(); ++it) { predicate_values.push_back(it->first); Vector values(it->second.begin(), diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index bc8b262c14..d75ec11de1 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -3589,7 +3589,7 @@ next_cell: { for (std::set::iterator it = face2_vertices.begin(); it != face2_vertices.end(); - it++) + ++it) { if (orthogonal_equality(face1->vertex(i),face2->vertex(*it), direction, offset, matrix)) diff --git a/source/grid/tria.cc b/source/grid/tria.cc index c0fa0b5e7a..a70616c3c6 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -1940,7 +1940,7 @@ namespace internal std::vector vertex_touch_count (v.size(), 0); typename std::map, typename Triangulation::line_iterator>::iterator i; - for (i=needed_lines.begin(); i!=needed_lines.end(); i++) + for (i=needed_lines.begin(); i!=needed_lines.end(); ++i) { // touch the vertices of // this line @@ -2310,7 +2310,7 @@ namespace internal std::vector vertex_touch_count (v.size(), 0); typename std::map, typename Triangulation::line_iterator>::iterator i; - for (i=needed_lines.begin(); i!=needed_lines.end(); i++) + for (i=needed_lines.begin(); i!=needed_lines.end(); ++i) { // touch the vertices of // this line @@ -9305,7 +9305,7 @@ copy_triangulation (const Triangulation &old_tria) typename std::map , Triangulation > >::const_iterator bdry_iterator = old_tria.manifold.begin(); - for (; bdry_iterator != old_tria.manifold.end() ; bdry_iterator++) + for (; bdry_iterator != old_tria.manifold.end() ; ++bdry_iterator) manifold[bdry_iterator->first] = bdry_iterator->second; diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index 55cc166cdb..2494eba0e7 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -639,7 +639,7 @@ namespace SparsityTools { Assert(ptr!=end, ExcInternalError()); dsp.add(row, *ptr); - ptr++; + ++ptr; } } Assert(ptr==end, ExcInternalError()); @@ -761,7 +761,7 @@ namespace SparsityTools { Assert(ptr!=end, ExcInternalError()); dsp.add(row, *ptr); - ptr++; + ++ptr; } } Assert(ptr==end, ExcInternalError()); diff --git a/source/numerics/point_value_history.cc b/source/numerics/point_value_history.cc index 3c071306e4..ee6cf4ad26 100644 --- a/source/numerics/point_value_history.cc +++ b/source/numerics/point_value_history.cc @@ -302,7 +302,7 @@ void PointValueHistory std::map > >::iterator data_store_begin = data_store.begin (); - for (; data_store_begin != data_store.end (); data_store_begin++) + for (; data_store_begin != data_store.end (); ++data_store_begin) { // add an extra row to each vector // entry @@ -422,7 +422,7 @@ void PointValueHistory std::map > >::iterator data_store_begin = data_store.begin (); - for (; data_store_begin != data_store.end (); data_store_begin++) + for (; data_store_begin != data_store.end (); ++data_store_begin) { // add an extra row to each vector // entry @@ -582,7 +582,7 @@ void PointValueHistory unsigned int n_stored = mask->second.n_selected_components(dof_handler->get_fe ().n_components ()); typename std::vector >::iterator point = point_geometry_data.begin (); - for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++) + for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index) { // Look up the components to add // in the component_mask, and @@ -636,7 +636,7 @@ void PointValueHistory // Loop over points and find correct cell typename std::vector >::iterator point = point_geometry_data.begin (); - for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++) + for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index) { // we now have a point to query, // need to know what cell it is in @@ -762,7 +762,7 @@ void PointValueHistory // we now have the data and need to save it // loop over data names typename std::vector::const_iterator name = vector_names.begin(); - for (; name != vector_names.end(); name++) + for (; name != vector_names.end(); ++name) { typename std::map > >::iterator data_store_field = data_store.find(*name); Assert (data_store_field != data_store.end(), ExcMessage("vector_name not in class")); @@ -834,7 +834,7 @@ void PointValueHistory typename std::vector >::iterator point = point_geometry_data.begin (); Vector value (dof_handler->get_fe().n_components()); - for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++) + for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index) { // Make a Vector for the value // at the point. It will have as many @@ -961,7 +961,7 @@ void PointValueHistory //AssertThrow (!triangulation_changed, ExcDoFHandlerChanged ()); typename std::vector >::iterator point = point_geometry_data.begin (); - for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++) + for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index) { // for each point, open a file to // be written to @@ -1081,7 +1081,7 @@ Vector PointValueHistory Vector dof_vector (dof_handler->n_dofs ()); typename std::vector >::iterator point = point_geometry_data.begin (); - for (; point != point_geometry_data.end (); point++) + for (; point != point_geometry_data.end (); ++point) { for (unsigned int component = 0; component < dof_handler->get_fe ().n_components (); component++) { @@ -1103,7 +1103,7 @@ void PointValueHistory std::vector > > actual_points; typename std::vector >::iterator point = point_geometry_data.begin (); - for (; point != point_geometry_data.end (); point++) + for (; point != point_geometry_data.end (); ++point) { actual_points.push_back (point->support_point_locations); } @@ -1134,7 +1134,7 @@ void PointValueHistory // Loop over points and find correct cell typename std::vector >::iterator point = point_geometry_data.begin (); - for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++) + for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index) { // we now have a point to query, // need to know what cell it is in @@ -1180,7 +1180,7 @@ void PointValueHistory { if (!cleared) { - for (; point != point_geometry_data.end (); point++) + for (; point != point_geometry_data.end (); ++point) { out << "# Requested location: " << point->requested_location << "\n"; out << "# DoF_index : Support location (for each component)\n"; @@ -1222,7 +1222,7 @@ void PointValueHistory { out << "Mnemonic: data set size (mask size, n true components) : n data sets\n"; } - for (; data_store_begin != data_store.end (); data_store_begin++) + for (; data_store_begin != data_store.end (); ++data_store_begin) { // Find field mnemonic std::string vector_name = data_store_begin->first; @@ -1278,7 +1278,7 @@ bool PointValueHistory data_store_begin = data_store.begin (); if (have_dof_handler) { - for (; data_store_begin != data_store.end (); data_store_begin++) + for (; data_store_begin != data_store.end (); ++data_store_begin) { Assert (data_store_begin->second.size() > 0, ExcInternalError()); @@ -1306,7 +1306,7 @@ bool PointValueHistory { std::map > >::iterator data_store_begin = data_store.begin (); - for (; data_store_begin != data_store.end (); data_store_begin++) + for (; data_store_begin != data_store.end (); ++data_store_begin) { Assert (data_store_begin->second.size() > 0, ExcInternalError());