[Rcpp-commits] r4308 - in pkg/Rcpp: . inst/include/Rcpp/traits
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Apr 14 09:50:55 CEST 2013
Author: romain
Date: 2013-04-14 09:50:55 +0200 (Sun, 14 Apr 2013)
New Revision: 4308
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/inst/include/Rcpp/traits/is_na.h
Log:
fix is_na for the complex case
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2013-04-10 09:29:10 UTC (rev 4307)
+++ pkg/Rcpp/ChangeLog 2013-04-14 07:50:55 UTC (rev 4308)
@@ -1,3 +1,8 @@
+2013-04-14 Romain Francois <romain at r-enthusiasts.com>
+
+ * include/Rcpp/traits/is_na.h: complex version did not work.
+ added default for VECSXP and EXPRSXP versions
+
2013-04-02 Dirk Eddelbuettel <edd at debian.org>
* src/Date.cpp: Corrected operator-() for Date and Datetime objects
Modified: pkg/Rcpp/inst/include/Rcpp/traits/is_na.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/is_na.h 2013-04-10 09:29:10 UTC (rev 4307)
+++ pkg/Rcpp/inst/include/Rcpp/traits/is_na.h 2013-04-14 07:50:55 UTC (rev 4308)
@@ -2,7 +2,7 @@
//
// is_na.h: Rcpp R/C++ interface class library -- vector operators
//
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois
//
// This file is part of Rcpp.
//
@@ -25,9 +25,11 @@
namespace Rcpp{
namespace traits{
- // no definition on purpose
+ // default to always false, applies to VECSXP, EXPRSXP and RAWSXP
template <int RTYPE>
- bool is_na( typename storage_type<RTYPE>::type ) ;
+ bool is_na( typename storage_type<RTYPE>::type ){
+ return false ;
+ }
template <>
inline bool is_na<INTSXP>( int x ){
@@ -41,13 +43,10 @@
template <>
inline bool is_na<CPLXSXP>( Rcomplex x ){
- return x.r == NA_REAL || x.i == NA_REAL;
+ return R_IsNA(x.r) || R_IsNA(x.i) ;
}
template <>
- inline bool is_na<RAWSXP>( Rbyte ){ return false; }
-
- template <>
inline bool is_na<STRSXP>( SEXP x ){ return x == NA_STRING ; }
template <>
More information about the Rcpp-commits
mailing list