changeset 8731:5abe5ae55465

use lo-traits in oct-inttypes
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 12 Feb 2009 10:00:43 +0100
parents 474f64ab905f
children a669df7beb73
files liboctave/ChangeLog liboctave/oct-inttypes.h
diffstat 2 files changed, 8 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- 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  <highegg@gmail.com>
+
+	* oct-inttypes.h (if_else_type): Remove
+	(octave_int_base::truncate_int): Use if_then_else.
+
 2009-02-12  John W. Eaton  <jwe@octave.org>
 
 	* lo-traits.h: New file.
--- 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 <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.