If we are going to have conversion operators, I think maybe they
should be limited to
operator () T (void) const { return value (); }
For now, I've added this operator to the octave_int class. I have not
removed the other conversions (bool, char, double, float), but they
might be deleted in some future version of Octave.
Does it help you to have this conversion operator?
jwe
2007-11-14 John W. Eaton <jwe <at> octave.org>
* oct-inttypes.h (opeator T (void) const): New conversion operator.
Index: liboctave/oct-inttypes.h
===================================================================
RCS file: /cvs/octave/liboctave/oct-inttypes.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -u -r1.32 -r1.33
--- liboctave/oct-inttypes.h 12 Oct 2007 21:27:16 -0000 1.32
+++ liboctave/oct-inttypes.h 14 Nov 2007 22:21:35 -0000 1.33
@@ -250,6 +250,8 @@
OCTAVE_INT_FIT_TO_RANGE (- static_cast<double> (ival), T) : 0;
}
+ operator T (void) const { return value (); }
+
operator bool (void) const { return static_cast<bool> (value ()); }
operator char (void) const { return static_cast<char> (value ()); }