[Rcpp-commits] r1706 - in pkg/Rcpp: . inst/include/Rcpp/sugar/operators

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 24 10:42:17 CEST 2010


Author: romain
Date: 2010-06-24 10:42:17 +0200 (Thu, 24 Jun 2010)
New Revision: 1706

Modified:
   pkg/Rcpp/TODO
   pkg/Rcpp/inst/include/Rcpp/sugar/operators/unary_minus.h
Log:
adjustments to unary operator-

Modified: pkg/Rcpp/TODO
===================================================================
--- pkg/Rcpp/TODO	2010-06-24 08:35:00 UTC (rev 1705)
+++ pkg/Rcpp/TODO	2010-06-24 08:42:17 UTC (rev 1706)
@@ -49,6 +49,8 @@
     
     o	operator% 
     
+    o	operator/ needs to handle the case of division by 0
+    
     o   for complex vectors: Re, Im, Mod, Arg, Conj
     
     o   min, max with specialization of the binary operators, so that we can do 

Modified: pkg/Rcpp/inst/include/Rcpp/sugar/operators/unary_minus.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/operators/unary_minus.h	2010-06-24 08:35:00 UTC (rev 1705)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/operators/unary_minus.h	2010-06-24 08:42:17 UTC (rev 1706)
@@ -79,16 +79,17 @@
 	} ;
 	
 
-	template <int RTYPE, bool _NA_, typename VEC_TYPE>
+	template <int RTYPE, bool NA, typename T>
 	class UnaryMinus_Vector : public Rcpp::VectorBase< 
 		unary_minus_result_type<RTYPE>::value ,
-		_NA_, 
-		UnaryMinus_Vector< unary_minus_result_type<RTYPE>::value ,_NA_,VEC_TYPE> 
+		NA, 
+		UnaryMinus_Vector< unary_minus_result_type<RTYPE>::value ,NA,T> 
 		> {
 	public:
+		typedef typename Rcpp::VectorBase<RTYPE,NA,T> VEC_TYPE ;
 		typedef typename traits::storage_type<RTYPE>::type STORAGE ;
 		typedef typename unary_minus_result_type<RTYPE>::type RESULT ;
-		typedef unary_minus<RTYPE,_NA_> OPERATOR ;
+		typedef unary_minus<RTYPE,NA> OPERATOR ;
 		
 		UnaryMinus_Vector( const VEC_TYPE& lhs_ ) : 
 			lhs(lhs_), op() {}
@@ -98,7 +99,6 @@
 		}
 		
 		inline int size() const { return lhs.size() ; }
-	
 		
 	private:
 		const VEC_TYPE& lhs ;
@@ -108,12 +108,12 @@
 }
 }
 
-template <int RTYPE,bool _NA_, typename T>
-inline Rcpp::sugar::UnaryMinus_Vector< RTYPE , _NA_ , Rcpp::VectorBase<RTYPE,_NA_,T> >
+template <int RTYPE,bool NA, typename T>
+inline Rcpp::sugar::UnaryMinus_Vector< RTYPE , NA , T >
 operator-( 
-	const Rcpp::VectorBase<RTYPE,_NA_,T>& x
+	const Rcpp::VectorBase<RTYPE,NA,T>& x
 ) {
-	return Rcpp::sugar::UnaryMinus_Vector<RTYPE,_NA_, Rcpp::VectorBase<RTYPE,_NA_,T> >( x ) ;
+	return Rcpp::sugar::UnaryMinus_Vector<RTYPE,NA, T >( x ) ;
 }
 
 



More information about the Rcpp-commits mailing list