diff libinterp/octave-value/ov-class.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 05b4479c29d8
children ae4e19c0a2b1
line wrap: on
line diff
--- a/libinterp/octave-value/ov-class.cc	Wed Dec 13 19:58:48 2023 +0100
+++ b/libinterp/octave-value/ov-class.cc	Wed Dec 13 15:48:06 2023 -0500
@@ -134,7 +134,7 @@
               // distribute the elements of the parent object to
               // the elements of MAP.
 
-              dim_vector parent_dims = parent.dims ();
+              const dim_vector& parent_dims = parent.dims ();
 
               m_map.resize (parent_dims);
 
@@ -331,7 +331,7 @@
     }
   else
     {
-      dim_vector dv = dims ();
+      const dim_vector& dv = dims ();
 
       int nd = dv.ndims ();