From: David Wells Date: Sat, 9 May 2020 19:30:58 +0000 (-0400) Subject: cppcheck: clean up use of references. X-Git-Tag: v9.2.0-rc1~60^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8d49de535ac45a65600e7a2e16d1a057b82346e;p=dealii.git cppcheck: clean up use of references. Capture by reference when the return type is by reference: capture by value when the return type is by value. --- diff --git a/include/deal.II/base/timer.h b/include/deal.II/base/timer.h index 0873c3f95a..88149f0cff 100644 --- a/include/deal.II/base/timer.h +++ b/include/deal.II/base/timer.h @@ -947,7 +947,7 @@ template inline void Timer::print_accumulated_wall_time_data(StreamType &stream) const { - const Utilities::MPI::MinMaxAvg statistic = get_accumulated_wall_time_data(); + const Utilities::MPI::MinMaxAvg &statistic = get_accumulated_wall_time_data(); stream << statistic.max << " wall," << " max @" << statistic.max_index << ", min=" << statistic.min << " @" << statistic.min_index << ", avg=" << statistic.avg << std::endl; diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index e9541a50b5..f83995c14f 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -1264,7 +1264,7 @@ namespace Utilities boost::archive::binary_oarchive archive(out); archive << object; - const std::string &s = out.str(); + const std::string s = out.str(); dest_buffer.reserve(dest_buffer.size() + s.size()); std::move(s.begin(), s.end(), std::back_inserter(dest_buffer)); }