Mercurial > hg > octave-lyh
comparison src/pt-unop.cc @ 9887:e3bd1569a68c
in-place operation of unary ops on temporary expressions
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sun, 29 Nov 2009 21:21:42 +0100 |
parents | d33a318c1de4 |
children | cd96d29c5efa |
comparison
equal
deleted
inserted
replaced
9886:cddd5c3d5f04 | 9887:e3bd1569a68c |
---|---|
87 { | 87 { |
88 octave_value val = op->rvalue1 (); | 88 octave_value val = op->rvalue1 (); |
89 | 89 |
90 if (! error_state && val.is_defined ()) | 90 if (! error_state && val.is_defined ()) |
91 { | 91 { |
92 retval = ::do_unary_op (etype, val); | 92 // Attempt to do the operation in-place if it is unshared |
93 // (a temporary expression). | |
94 if (val.get_count () == 1) | |
95 retval = val.do_non_const_unary_op (etype); | |
96 else | |
97 retval = ::do_unary_op (etype, val); | |
93 | 98 |
94 if (error_state) | 99 if (error_state) |
95 retval = octave_value (); | 100 retval = octave_value (); |
96 } | 101 } |
97 } | 102 } |