# HG changeset patch # User John W. Eaton # Date 1340744028 14400 # Node ID d40349493d874022ed9187e729c6b25e7aa53b89 # Parent 2e2a336c6b4813b1d6c64142336e7e344f11dce7 provide template version of octave_NA * lo-ieee.h (octave_numeric_limits): New template for NA value. Provide specializations for double and float. diff -r 2e2a336c6b48 -r d40349493d87 liboctave/lo-ieee.h --- a/liboctave/lo-ieee.h Tue Jun 26 16:50:35 2012 -0400 +++ b/liboctave/lo-ieee.h Tue Jun 26 16:53:48 2012 -0400 @@ -118,4 +118,26 @@ #define lo_ieee_signbit(x) (sizeof (x) == sizeof (float) ? \ __lo_ieee_float_signbit (x) : __lo_ieee_signbit (x)) +#ifdef __cplusplus + +template +struct octave_numeric_limits +{ + static T NA (void) { return static_cast (0); } +}; + +template <> +struct octave_numeric_limits +{ + static double NA (void) { return octave_NA; } +}; + +template <> +struct octave_numeric_limits +{ + static float NA (void) { return octave_Float_NA; } +}; + #endif + +#endif