freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Guard Vector constructors


From: Richard Guenther
Subject: [PATCH] Guard Vector constructors
Date: Wed, 3 Dec 2003 21:47:11 +0100 (CET)

Hi!

I just had a swep over my local changes and found this (and others, see
following mails). It guards the Vector constructors by dimensionality
checks. I suppose this bit me at a time.

Checked by being in my tree for a long time (don't know if that counts,
though ;)).

Ok?

Richard.

Index: Vector.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Tiny/Vector.h,v
retrieving revision 1.31
diff -u -u -r1.31 Vector.h
--- Vector.h    21 Oct 2003 19:50:04 -0000      1.31
+++ Vector.h    3 Dec 2003 20:39:37 -0000
@@ -291,12 +291,14 @@
   template<class X1, class X2>
     inline VectorEngine(const X1& x, const X2& y)
       {
+       CTAssert(D == 2);
         x_m[0] = x;
         x_m[1] = y;
        }
   template<class X1, class X2, class X3>
     inline VectorEngine(const X1& x, const X2& y, const X3& z)
       {
+       CTAssert(D == 3);
         x_m[0] = x;
         x_m[1] = y;
         x_m[2] = z;
@@ -305,6 +307,7 @@
     inline VectorEngine(const X1& x, const X2& y, const X3& z,
       const X4& a)
       {
+       CTAssert(D == 4);
         x_m[0] = x;
         x_m[1] = y;
         x_m[2] = z;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]