Mercurial > jwe > octave
changeset 22212:2b487dbe419d
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.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sat, 06 Aug 2016 04:15:07 +0100 |
parents | 6065bd58db2b |
children | 1723063e65f3 |
files | liboctave/array/dim-vector.cc liboctave/array/dim-vector.h |
diffstat | 2 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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().