diff liboctave/array/Array-util.cc @ 32598:2f3b54f81947

avoid dim_vector copies in more places where possible (bug #64962) Where possible, use const reference to capture temporary dim_vector objects instead of making copies. Affected files: variable-editor-model.cc, besselj.cc, bitfcns.cc, cellfun.cc, data.cc, ellipj.cc, filter.cc, find.cc, gl-render.cc, graphics.cc, graphics.in.h, jsondecode.cc, jsonencode.cc, ls-mat5.cc, matrix_type.cc, mex.cc, oct-map.cc, pr-output.cc, sub2ind.cc, tril.cc, xpow.cc, ov-base-diag.cc, ov-base-int.cc, ov-base-mat.cc, ov-base-sparse.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-intx.h, ov-java.cc, ov-perm.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-str-mat.cc, ov-struct.cc, ovl.cc, op-int.h, op-str-str.cc, op-struct.cc, pt-eval.cc, pt-tm-const.cc, Array-base.cc, Array-util.cc, CNDArray.cc, CSparse.cc, Sparse.cc, dNDArray.cc, dSparse.cc, fCNDArray.cc, fNDArray.cc, bsxfun-defs.cc, lo-specfun.cc, mx-inlines.cc, oct-binmap.h.
author John W. Eaton <jwe@octave.org>
date Wed, 13 Dec 2023 15:48:06 -0500
parents c8dd3da44e83
children 4b601ca024d5
line wrap: on
line diff
--- a/liboctave/array/Array-util.cc	Wed Dec 13 19:58:48 2023 +0100
+++ b/liboctave/array/Array-util.cc	Wed Dec 13 15:48:06 2023 -0500
@@ -617,7 +617,7 @@
     {
       OCTAVE_LOCAL_BUFFER (Array<octave_idx_type>, rdata, n);
 
-      dim_vector odv = idx.orig_dimensions ();
+      const dim_vector& odv = idx.orig_dimensions ();
       for (octave_idx_type j = 0; j < n; j++)
         rdata[j] = Array<octave_idx_type> (odv);