Mercurial > octave
diff src/ov.h @ 8546:3d8a914c580e
improve parser indexed assigment code
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 20 Jan 2009 21:15:17 +0100 |
parents | b01fef323c24 |
children | 906f976d35a8 |
line wrap: on
line diff
--- a/src/ov.h Tue Jan 20 11:09:22 2009 -0500 +++ b/src/ov.h Tue Jan 20 21:15:17 2009 +0100 @@ -298,6 +298,19 @@ } } + // This uniquifies the value if it is referenced by more than a certain + // number of shallow copies. This is useful for optimizations where we + // know a certain copy, typically within a cell array, to be obsolete. + void make_unique (int obsolete_copies) + { + if (rep->count > obsolete_copies + 1) + { + --rep->count; + rep = rep->clone (); + rep->count = 1; + } + } + // Simple assignment. octave_value& operator = (const octave_value& a)