# HG changeset patch # User Jaroslav Hajek # Date 1234429243 -3600 # Node ID 5abe5ae55465c7944b06d8181af40143e0c83e3a # Parent 474f64ab905f6d7953a7d8177c96e86e5aa6d2d3 use lo-traits in oct-inttypes diff -r 474f64ab905f -r 5abe5ae55465 liboctave/ChangeLog --- a/liboctave/ChangeLog Thu Feb 12 03:44:41 2009 -0500 +++ b/liboctave/ChangeLog Thu Feb 12 10:00:43 2009 +0100 @@ -1,3 +1,8 @@ +2009-02-12 Jaroslav Hajek + + * oct-inttypes.h (if_else_type): Remove + (octave_int_base::truncate_int): Use if_then_else. + 2009-02-12 John W. Eaton * lo-traits.h: New file. diff -r 474f64ab905f -r 5abe5ae55465 liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h Thu Feb 12 03:44:41 2009 -0500 +++ b/liboctave/oct-inttypes.h Thu Feb 12 10:00:43 2009 +0100 @@ -30,6 +30,7 @@ #include #include +#include "lo-traits.h" #include "lo-math.h" #include "oct-types.h" #include "lo-ieee.h" @@ -80,23 +81,6 @@ REGISTER_INT_TYPE (int64_t); REGISTER_INT_TYPE (uint64_t); -// Selects one of two types, according to a static bool. May be useful in -// general. - -template -class if_else_type -{ -public: - typedef FT type; -}; - -template -class if_else_type -{ -public: - typedef TT type; -}; - // Rationale: Comparators have a single static method, rel(), that returns the // result of the binary relation. They also have two static boolean fields: // ltval, gtval determine the value of x OP y if x < y, x > y, respectively. @@ -253,8 +237,8 @@ typedef octave_int_cmp_op::cf cf; typedef octave_int_cmp_op::lt lt; typedef octave_int_cmp_op::gt gt; - typedef typename if_else_type::type chk_min; - typedef typename if_else_type::type chk_max; + typedef typename if_then_else::result chk_min; + typedef typename if_then_else::result chk_max; // Efficiency of the following depends on inlining and dead code // elimination, but that should be a piece of cake for most compilers.