From: Jean-Paul Pelteret Date: Tue, 22 Jan 2019 15:18:57 +0000 (+0100) Subject: Remove unnecessary temporary object when copying a vector X-Git-Tag: v9.1.0-rc1~389^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79c6959019e0978510b49f8ef7aa6a90bbbf3ee2;p=dealii.git Remove unnecessary temporary object when copying a vector --- diff --git a/source/differentiation/ad/ad_drivers.cc b/source/differentiation/ad/ad_drivers.cc index 3d29e40a5b..ff0a9637cf 100644 --- a/source/differentiation/ad/ad_drivers.cc +++ b/source/differentiation/ad/ad_drivers.cc @@ -476,17 +476,13 @@ namespace Differentiation { // We've chosen to use unsigned shorts for the tape // index type (a safety precaution) so we need to - // perform a conversion betwwen ADOL-C's native tape + // perform a conversion between ADOL-C's native tape // index type and that chosen by us. std::vector registered_tape_indices_s; cachedTraceTags(registered_tape_indices_s); - std::vector::tape_index> - registered_tape_indices(registered_tape_indices_s.size()); - std::copy(registered_tape_indices_s.begin(), - registered_tape_indices_s.end(), - registered_tape_indices.begin()); - return registered_tape_indices; + return std::vector::tape_index>( + registered_tape_indices_s.begin(), registered_tape_indices_s.end()); } @@ -537,8 +533,10 @@ namespace Differentiation // See ADOL-C manual section 1.7 and comments in last paragraph of // section 3.1 - Assert(status_tape < 4 && status_tape >= -2, - ExcIndexRange(status_tape, -2, 4)); + Assert( + status_tape < 4 && status_tape >= -2, + ExcMessage( + "The tape status is not within the range specified within the ADOL-C documentation.")); return (status_tape < 0); }