From: David Wells Date: Mon, 9 Oct 2017 17:52:25 +0000 (-0400) Subject: Prefer iterators to pointers. X-Git-Tag: v9.0.0-rc1~954^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aacc021f229dba472cd28d67324e4e41f40640ab;p=dealii.git Prefer iterators to pointers. --- diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index f71851f3a9..95664a9fc8 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -2335,8 +2335,8 @@ next_cell: int ierr = MPI_Allgather(&next_index, 1, DEAL_II_DOF_INDEX_MPI_TYPE, indices.data(), indices.size(), DEAL_II_DOF_INDEX_MPI_TYPE, triangulation.get_communicator()); AssertThrowMPI(ierr); - const types::global_vertex_index shift = std::accumulate(&indices[0], - &indices[0]+triangulation.locally_owned_subdomain(), + const types::global_vertex_index shift = std::accumulate(indices.begin(), + indices.begin()+triangulation.locally_owned_subdomain(), types::global_vertex_index(0)); std::map::iterator diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index 1866193aae..8590796ba4 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -590,7 +590,7 @@ get_new_points (const ArrayView> &surrounding_points, // check whether periodicity shifts some of the points. Only do this if // necessary to avoid memory allocation - const Point *surrounding_points_start = &surrounding_points[0]; + const Point *surrounding_points_start = surrounding_points.begin(); boost::container::small_vector, 200> modified_points; bool adjust_periodicity = false; diff --git a/source/particles/particle.cc b/source/particles/particle.cc index 2c4ad4515f..092a3d295a 100644 --- a/source/particles/particle.cc +++ b/source/particles/particle.cc @@ -64,7 +64,7 @@ namespace Particles { const ArrayView their_properties = particle.get_properties(); - std::copy(&their_properties[0],&their_properties[0]+their_properties.size(),&my_properties[0]); + std::copy(their_properties.begin(), their_properties.end(), my_properties.begin()); } } } @@ -131,7 +131,7 @@ namespace Particles if (their_properties.size() != 0) { const ArrayView my_properties = property_pool->get_properties(properties); - std::copy(&their_properties[0],&their_properties[0]+their_properties.size(),&my_properties[0]); + std::copy(their_properties.begin(), their_properties.end(), my_properties.begin()); } } else @@ -284,7 +284,7 @@ namespace Particles + "This is not allowed.")); if (old_properties.size() > 0) - std::copy(new_properties.begin(),new_properties.end(),&old_properties[0]); + std::copy(new_properties.begin(), new_properties.end(), old_properties.begin()); }