Mercurial > octave
diff src/ov-intx.h @ 12645:d3ccd2e37de6 stable
Allow scalar integer to logical conversion (bug #33219)
* ov-intx.h (OCTAVE_VALUE_INT_SCALAR_T::bool_value): New funtion.
* ov-bool-mat.cc: New tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 04 May 2011 13:59:34 -0400 |
parents | 12df7854fa7c |
children | 72c96de7a403 |
line wrap: on
line diff
--- a/src/ov-intx.h Sun May 01 11:39:50 2011 -0700 +++ b/src/ov-intx.h Wed May 04 13:59:34 2011 -0400 @@ -564,6 +564,14 @@ return retval; } + bool bool_value (bool warn = false) const + { + if (warn && scalar != 0.0 && scalar != 1.0) + gripe_logical_conversion (); + + return scalar.bool_value (); + } + boolNDArray bool_array_value (bool warn = false) const {