]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Compute the size of a std::vector without dereferencing the end iterator.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 30 Jun 2011 21:11:42 +0000 (21:11 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 30 Jun 2011 21:11:42 +0000 (21:11 +0000)
git-svn-id: https://svn.dealii.org/trunk@23889 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/base/index_set.cc

index 1bf4332d3ce473850eec07501dc89b6f4d1b575e..f00657ed85237e376b4540be3c8fb69f77c04cf0 100644 (file)
@@ -249,8 +249,7 @@ IndexSet::block_write(std::ostream & out) const
            sizeof(n_ranges));
   if (ranges.empty() == false)
     out.write (reinterpret_cast<const char*>(&*ranges.begin()),
-              reinterpret_cast<const char*>(&*ranges.end())
-              - reinterpret_cast<const char*>(&*ranges.begin()));
+              ranges.size() * sizeof(Range));
   Assert (out, ExcIO());
 }
 

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.