Mercurial > hg > octave-lyh
diff liboctave/oct-inttypes.h @ 8731:5abe5ae55465
use lo-traits in oct-inttypes
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 12 Feb 2009 10:00:43 +0100 |
parents | 9238637cb81c |
children | ab4db66e286f |
line wrap: on
line diff
--- a/liboctave/oct-inttypes.h +++ b/liboctave/oct-inttypes.h @@ -30,6 +30,7 @@ #include <limits> #include <iostream> +#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<bool cond, class TT, class FT> -class if_else_type -{ -public: - typedef FT type; -}; - -template<class TT, class FT> -class if_else_type<true, TT, FT> -{ -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<omit_chk_min, cf, lt>::type chk_min; - typedef typename if_else_type<omit_chk_max, cf, gt>::type chk_max; + typedef typename if_then_else<omit_chk_min, cf, lt>::result chk_min; + typedef typename if_then_else<omit_chk_max, cf, gt>::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.