Mercurial > hg > octave-nkf
comparison liboctave/Array.h @ 12125:a21a3875ca83
implement a common class for reference counts
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 20 Jan 2011 11:10:27 +0100 |
parents | 12df7854fa7c |
children | 43cc49c7abd1 |
comparison
equal
deleted
inserted
replaced
12124:cd82f5933c73 | 12125:a21a3875ca83 |
---|---|
37 #include "lo-traits.h" | 37 #include "lo-traits.h" |
38 #include "lo-utils.h" | 38 #include "lo-utils.h" |
39 #include "oct-sort.h" | 39 #include "oct-sort.h" |
40 #include "quit.h" | 40 #include "quit.h" |
41 #include "oct-mem.h" | 41 #include "oct-mem.h" |
42 #include "oct-refcount.h" | |
42 | 43 |
43 // One dimensional array class. Handles the reference counting for | 44 // One dimensional array class. Handles the reference counting for |
44 // all the derived classes. | 45 // all the derived classes. |
45 | 46 |
46 template <class T> | 47 template <class T> |
57 { | 58 { |
58 public: | 59 public: |
59 | 60 |
60 T *data; | 61 T *data; |
61 octave_idx_type len; | 62 octave_idx_type len; |
62 int count; | 63 octave_refcount<int> count; |
63 | 64 |
64 ArrayRep (T *d, octave_idx_type l) | 65 ArrayRep (T *d, octave_idx_type l) |
65 : data (no_ctor_new<T> (l)), len (l), count (1) | 66 : data (no_ctor_new<T> (l)), len (l), count (1) |
66 { | 67 { |
67 copy_or_memcpy (l, d, data); | 68 copy_or_memcpy (l, d, data); |