Mercurial > hg > octave-lyh
comparison liboctave/Sparse.h @ 7717:ff918ee1a983
Delete idx in Sparse<T> and Array<T> operator =
author | David Bateman <dbateman@free.fr> |
---|---|
date | Wed, 16 Apr 2008 23:33:36 +0200 |
parents | 36594d5bbe13 |
children | 1ebcb9872ced |
comparison
equal
deleted
inserted
replaced
7716:9c15f385811c | 7717:ff918ee1a983 |
---|---|
220 Sparse (const Array2<T>& a); | 220 Sparse (const Array2<T>& a); |
221 Sparse (const Array<T>& a); | 221 Sparse (const Array<T>& a); |
222 | 222 |
223 virtual ~Sparse (void); | 223 virtual ~Sparse (void); |
224 | 224 |
225 Sparse<T>& operator = (const Sparse<T>& a) | 225 Sparse<T>& operator = (const Sparse<T>& a); |
226 { | |
227 if (this != &a) | |
228 { | |
229 if (--rep->count <= 0) | |
230 delete rep; | |
231 | |
232 rep = a.rep; | |
233 rep->count++; | |
234 | |
235 dimensions = a.dimensions; | |
236 } | |
237 | |
238 idx_count = 0; | |
239 idx = 0; | |
240 | |
241 return *this; | |
242 } | |
243 | 226 |
244 // Note that nzmax and capacity are the amount of storage for | 227 // Note that nzmax and capacity are the amount of storage for |
245 // non-zero elements, while nnz is the actual number of non-zero | 228 // non-zero elements, while nnz is the actual number of non-zero |
246 // terms. | 229 // terms. |
247 octave_idx_type nzmax (void) const { return rep->length (); } | 230 octave_idx_type nzmax (void) const { return rep->length (); } |