# HG changeset patch # User Carnë Draug # Date 1470453307 -3600 # Node ID 2b487dbe419d00f76274328cf0e688e5bafcc21b # Parent 6065bd58db2be0a849d9bcec621dccf64ac6fdd1 dim-vector.h (ndims): do not return a reference to the rep. * dim-vector.h (ndims): this methods was only made public recently with dcee67d28570 and is not used anywhere else. It would expose the rep for no gain, so always return the int by copy. * dim-vector.cc: access the ndims on rep directly. diff -r 6065bd58db2b -r 2b487dbe419d liboctave/array/dim-vector.cc --- a/liboctave/array/dim-vector.cc Thu Feb 26 22:15:54 2015 +0530 +++ b/liboctave/array/dim-vector.cc Sat Aug 06 04:15:07 2016 +0100 @@ -63,7 +63,7 @@ if (j == 1) rep[1] = 1; - ndims () = j > 2 ? j : 2; + rep[-1] = j > 2 ? j : 2; } std::string diff -r 6065bd58db2b -r 2b487dbe419d liboctave/array/dim-vector.h --- a/liboctave/array/dim-vector.h Thu Feb 26 22:15:54 2015 +0530 +++ b/liboctave/array/dim-vector.h Sat Aug 06 04:15:07 2016 +0100 @@ -243,7 +243,7 @@ do l--; while (l > 2 && rep[l-1] == 1); - ndims () = l; + rep[-1] = l; } } @@ -303,7 +303,7 @@ elements in the dim_vector including trailing singetons. It is also the number of dimensions an Array with this dim_vector would have. */ - octave_idx_type& ndims (void) const { return rep[-1]; } + octave_idx_type ndims (void) const { return rep[-1]; } //! Number of dimensions. //! Synonymous with ndims().