octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: conversion of octave_int<short int> to int? moved from help-octave


From: Moritz Borgmann
Subject: Re: conversion of octave_int<short int> to int? moved from help-octave
Date: Mon, 26 Nov 2007 20:01:55 +0100

I propose that this patch be removed again, since it doesn't compile on Solaris CC. Why it does in fact compile under gcc is beyond me. See the thread "Solaris: Multiple declaration for octave_int<char>::operator char() const" started on bug-octave on Thu, 22 Nov 2007 02:54:23 +0100.

Reverting the patch may not be the best solution in the long run, but it is certainly better than a solution that doesn't even compile. IIRC, the patch was not necessary for any octave core functionality.

More discussion on the conversion operators is probably needed for a permanent solution.

Moritz

On 2007-11-14 22:25:55 GMT, jwe wrote:
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 ()); }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]