[Rcpp-commits] r4555 - in pkg/Rcpp/inst: . include/Rcpp/traits

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Oct 3 14:00:23 CEST 2013


Author: edd
Date: 2013-10-03 14:00:23 +0200 (Thu, 03 Oct 2013)
New Revision: 4555

Modified:
   pkg/Rcpp/inst/NEWS.Rd
   pkg/Rcpp/inst/include/Rcpp/traits/is_finite.h
   pkg/Rcpp/inst/include/Rcpp/traits/is_na.h
Log:
corrected where Thomas's small patch is applied


Modified: pkg/Rcpp/inst/NEWS.Rd
===================================================================
--- pkg/Rcpp/inst/NEWS.Rd	2013-10-02 23:43:24 UTC (rev 4554)
+++ pkg/Rcpp/inst/NEWS.Rd	2013-10-03 12:00:23 UTC (rev 4555)
@@ -8,7 +8,8 @@
     \itemize{
       \item Two missing \code{is<>()} templates for
       \code{CharacterVector} and \code{CharacterMatrix} have been added,
-      and tests for \code{is.na()} have been corrected thanks to Thomas Tse.  
+      and some tests for \code{is_na()} and \code{is_finite()} have been
+      corrected thanks to Thomas Tse.   
     }
   }
 }

Modified: pkg/Rcpp/inst/include/Rcpp/traits/is_finite.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/is_finite.h	2013-10-02 23:43:24 UTC (rev 4554)
+++ pkg/Rcpp/inst/include/Rcpp/traits/is_finite.h	2013-10-03 12:00:23 UTC (rev 4555)
@@ -1,4 +1,4 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
 //
 // is_finite.h: Rcpp R/C++ interface class library -- is finite
 //                                                                      
@@ -23,33 +23,38 @@
 #define Rcpp__traits_is_finite_h
 
 namespace Rcpp{
-namespace traits{
-	
-	// default for complex, 
-	template <int RTYPE> 
-	bool is_finite( typename storage_type<RTYPE>::type) ;
-	
-	template <> 
-	inline bool is_finite<INTSXP>( int x ){
-		return x != NA_INTEGER ;
-	}
-	
-	template <> 
-	inline bool is_finite<REALSXP>( double x ){
-		return R_finite(x) ;
-	}
-	
-	template <> 
-	inline bool is_finite<CPLXSXP>( Rcomplex x ){
-		return !( !R_finite(x.r) || !R_finite(x.i) );
-	}
-	
-	template <>
-	inline bool is_finite<STRSXP>( SEXP x ){ return x != NA_STRING ; }
-	
-	template <>
-	inline bool is_finite<LGLSXP>( int x ){ return x != NA_LOGICAL ; }
-	
+
+    namespace traits{
+        
+        // default for complex, 
+        template <int RTYPE> 
+        bool is_finite( typename storage_type<RTYPE>::type);
+        
+        template <> 
+        inline bool is_finite<INTSXP>(int x){
+            return x != NA_INTEGER;
+        }
+        
+        template <> 
+        inline bool is_finite<REALSXP>(double x) {
+            return R_finite(x);
+        }
+        
+        template <> 
+        inline bool is_finite<CPLXSXP>(Rcomplex x) {
+            return !( !R_finite(x.r) || !R_finite(x.i) );
+        }
+        
+        template <>
+        inline bool is_finite<STRSXP>(SEXP x) { 
+            return false; // see rcpp-devel on 2013-10-02; was:  x != NA_STRING; 
+        }
+        
+        template <>
+        inline bool is_finite<LGLSXP>(int x) { 
+            return x != NA_LOGICAL; 
+        }
+        
 }
 }
 

Modified: pkg/Rcpp/inst/include/Rcpp/traits/is_na.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/is_na.h	2013-10-02 23:43:24 UTC (rev 4554)
+++ pkg/Rcpp/inst/include/Rcpp/traits/is_na.h	2013-10-03 12:00:23 UTC (rev 4555)
@@ -49,7 +49,7 @@
         
         template <>
         inline bool is_na<STRSXP>(SEXP x) { 
-            return false; // see rcpp-devel on 2013-10-02; was:  x == NA_STRING; 
+            return x == NA_STRING; 
         }
         
         template <>



More information about the Rcpp-commits mailing list