From 79c6959019e0978510b49f8ef7aa6a90bbbf3ee2 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Tue, 22 Jan 2019 16:18:57 +0100 Subject: [PATCH] Remove unnecessary temporary object when copying a vector --- source/differentiation/ad/ad_drivers.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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); } -- 2.39.5