stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Farid_Zari...@epam.com>
Subject [PATCH] 26.valarray.cassign.cpp
Date Fri, 27 Jul 2007 14:39:01 GMT
  The 26.valarray.cassign.cpp test expect that UserClass type
provides +, -, *, / operations. But these operations are not
defined in rw_value.h.

  The patch below defines them and also deletes res_array.

Index: 26.valarray.cassign.cpp
===================================================================
--- 26.valarray.cassign.cpp	(revision 560134)
+++ 26.valarray.cassign.cpp	(working copy)
@@ -240,6 +240,19 @@
 
 int value (const UserClass &val) { return val.data_.val_; }
 
+#define USERCLASS_OPERATOR(op)
\
+inline UserClass operator##op (const UserClass& __x, const UserClass&
__y) \
+{
\
+    UserClass __tmp (__x);
\
+    __tmp op##= __y;
\
+    return __tmp;
\
+} typedef void rw_unused_typedef
+
+USERCLASS_OPERATOR (+);
+USERCLASS_OPERATOR (-);
+USERCLASS_OPERATOR (*);
+USERCLASS_OPERATOR (/);
+
 
/***********************************************************************
***/
 
 template <class T>
@@ -332,6 +345,7 @@
 
     delete_array (lhs_array, nelems);
     delete_array (rhs_array, nelems);
+    delete_array (res_array, nelems);
 
     std::free (fname);
 }

Farid.

Mime
View raw message