]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prefer iterators to pointers. 5217/head
authorDavid Wells <wellsd2@rpi.edu>
Mon, 9 Oct 2017 17:52:25 +0000 (13:52 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Thu, 12 Oct 2017 19:57:47 +0000 (15:57 -0400)
source/grid/grid_tools.cc
source/grid/manifold.cc
source/particles/particle.cc

index f71851f3a9fe0a1427755597b5bd2fff7f4e6c5a..95664a9fc87761249311788908066ce16542b608 100644 (file)
@@ -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<unsigned int,types::global_vertex_index>::iterator
index 1866193aaeef2404fd0378fec6cc42848886037c..8590796ba4c47852c4be9d497c2cb34670572830 100644 (file)
@@ -590,7 +590,7 @@ get_new_points (const ArrayView<const Point<spacedim>> &surrounding_points,
 
   // check whether periodicity shifts some of the points. Only do this if
   // necessary to avoid memory allocation
-  const Point<spacedim> *surrounding_points_start = &surrounding_points[0];
+  const Point<spacedim> *surrounding_points_start = surrounding_points.begin();
 
   boost::container::small_vector<Point<spacedim>, 200> modified_points;
   bool adjust_periodicity = false;
index 2c4ad4515f8d1b8ac32bdb591f4ae2a61d101a32..092a3d295ae1b41552b76ac8eb035d73d73f5191 100644 (file)
@@ -64,7 +64,7 @@ namespace Particles
           {
             const ArrayView<const double> 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<double> 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());
   }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.