[PATCH] fix Tiny/Zero.h

Richard Guenther rguenth at tat.physik.uni-tuebingen.de
Mon Jul 22 12:55:25 UTC 2002


The attached patch makes the Zero class work - protection is fixed,
as well as missing const and ambigous return type traits.

One<T> class to come.

Richard.

--
Richard Guenther <richard.guenther at uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
The GLAME Project: http://www.glame.de/
-------------- next part --------------
2002Jul22  Richard Guenther <richard.guenther at uni-tuebingen.de>

        * Tiny/Zero.h: fixed class protection
        const'ified operator T()
        deleted ambigous return type specializations

-------------- next part --------------
Index: src/Tiny/Zero.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Tiny/Zero.h,v
retrieving revision 1.6
diff -u -r1.6 Zero.h
--- src/Tiny/Zero.h	2000/03/07 13:18:17	1.6
+++ src/Tiny/Zero.h	2002/07/22 12:51:50
@@ -67,13 +67,13 @@
 //-----------------------------------------------------------------------------
 
 template<class T>
-class Zero
+struct Zero
 {
   // If you need to convert to an object of type T,
   // just build one from zero.  This will be used in 
   // the cases where the operators below don't match.
 
-  operator T() { return T(0); }
+  operator T() const { return T(0); }
 
 
   // Give it empty ctors and assignment operators
@@ -238,24 +238,6 @@
 // Trait class definitios for the cases where the Zero<T> gets
 // converted to a T.
 //
-
-template<class T, class Op>
-struct UnaryReturn< Zero<T> , Op >
-{
-  typedef typename UnaryReturn<T,Op>::Type_t Type_t;
-};
-
-template<class T1, class T2, class Op>
-struct BinaryReturn< Zero<T1> , T2, Op >
-{
-  typedef typename BinaryReturn<T1,T2,Op>::Type_t Type_t;
-};
-
-template<class T1, class T2, class Op>
-struct BinaryReturn< T1 , Zero<T2>, Op >
-{
-  typedef typename BinaryReturn<T1,T2,Op>::Type_t Type_t;
-};
 
 template<class T1, class T2, class Op>
 struct BinaryReturn< Zero<T1> , Zero<T2>, Op >


More information about the pooma-dev mailing list