Actions

icon Post
text/html Subscribe
text/html Unsubscribe

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

PATCH: restrict vsip::operator! to view types


  • To: VSIPL++ Developers List <vsipl++@xxxxxxxxxxxxxxxx>
  • Subject: PATCH: restrict vsip::operator! to view types
  • From: Stefan Seefeld <stefan@xxxxxxxxxxxxxxxx>
  • Date: Fri, 11 Nov 2005 12:19:39 -0500

As the subject-line says, the attached patch uses sfinae
to restrict the unary operators '!' and '~' to operate
on view types only.
The patch doesn't seem to introduce regressions for g++ 3.4.2,
and makes a number of tests compile with ghs.

Regards,
		Stefan
Index: src/vsip/impl/fns_elementwise.hpp
===================================================================
RCS file: /home/cvs/Repository/vpp/src/vsip/impl/fns_elementwise.hpp,v
retrieving revision 1.14
diff -u -r1.14 fns_elementwise.hpp
--- src/vsip/impl/fns_elementwise.hpp	3 Oct 2005 12:49:42 -0000	1.14
+++ src/vsip/impl/fns_elementwise.hpp	11 Nov 2005 17:14:05 -0000
@@ -74,7 +74,8 @@
 #define VSIP_IMPL_UNARY_OP(op, name)           			          \
 template <typename T>	 				                  \
 typename Dispatch_##name<T>::result_type			          \
-operator op(T t) { return Dispatch_##name<T>::apply(t);}
+operator op(typename Is_view_type<T>::type t)                             \
+{ return Dispatch_##name<T>::apply(t);}
 
 /// Macro to define a binary function on views in terms of
 /// its homologe on scalars.