comparison liboctave/array/dim-vector.h @ 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 b1256fb38777
children 1723063e65f3
comparison
equal deleted inserted replaced
22211:6065bd58db2b 22212:2b487dbe419d
241 { 241 {
242 make_unique (); 242 make_unique ();
243 do 243 do
244 l--; 244 l--;
245 while (l > 2 && rep[l-1] == 1); 245 while (l > 2 && rep[l-1] == 1);
246 ndims () = l; 246 rep[-1] = l;
247 } 247 }
248 } 248 }
249 249
250 void chop_all_singletons (void); 250 void chop_all_singletons (void);
251 251
301 /*! 301 /*!
302 Returns the number of dimensions of the dim_vector. This is number of 302 Returns the number of dimensions of the dim_vector. This is number of
303 elements in the dim_vector including trailing singetons. It is also 303 elements in the dim_vector including trailing singetons. It is also
304 the number of dimensions an Array with this dim_vector would have. 304 the number of dimensions an Array with this dim_vector would have.
305 */ 305 */
306 octave_idx_type& ndims (void) const { return rep[-1]; } 306 octave_idx_type ndims (void) const { return rep[-1]; }
307 307
308 //! Number of dimensions. 308 //! Number of dimensions.
309 //! Synonymous with ndims(). 309 //! Synonymous with ndims().
310 /*! 310 /*!
311 While this method is not officially deprecated, consider using ndims() 311 While this method is not officially deprecated, consider using ndims()