Skip to content

Commit de32263

Browse files
maybe the compiler will stfu. closes #68
1 parent 743d83e commit de32263

File tree

1 file changed

+38
-30
lines changed

1 file changed

+38
-30
lines changed

inst/include/Rcpp/Na_Proxy.h

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This file is part of Rcpp.
44
//
5-
// Rcppis free software: you can redistribute it and/or modify it
5+
// Rcpp is free software: you can redistribute it and/or modify it
66
// under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 2 of the License, or
88
// (at your option) any later version.
@@ -19,36 +19,44 @@
1919
#define Rcpp_Na_Proxy_h
2020

2121
namespace Rcpp{
22-
class Na_Proxy{} ;
22+
class Na_Proxy{
23+
24+
friend inline bool operator==(double x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<REALSXP>(x) ; }
25+
friend inline bool operator==(int x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<INTSXP>(x) ; }
26+
friend inline bool operator==(Rcpp::String x, Rcpp::Na_Proxy){ return Rcpp::traits::is_na<STRSXP>(x.get_sexp()) ; }
27+
friend inline bool operator==(Rcomplex x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<CPLXSXP>(x) ; }
28+
friend inline bool operator==(SEXP x , Rcpp::Na_Proxy){ return TYPEOF(x)==CHARSXP && Rcpp::traits::is_na<STRSXP>(x) ; }
29+
friend inline bool operator==(std::string , Rcpp::Na_Proxy){ return false ; }
30+
friend inline bool operator==(const char* , Rcpp::Na_Proxy){ return false ; }
31+
friend inline bool operator==(Rcpp::internal::string_proxy<STRSXP> x, Rcpp::Na_Proxy){
32+
return Rcpp::traits::is_na<STRSXP>(x.get()) ;
33+
}
34+
friend inline bool operator==(Rcpp::internal::const_string_proxy<STRSXP> x, Rcpp::Na_Proxy){
35+
return Rcpp::traits::is_na<STRSXP>(x.get()) ;
36+
}
37+
38+
friend inline bool operator==(Rcpp::Na_Proxy, double x ){ return Rcpp::traits::is_na<REALSXP>(x) ; }
39+
friend inline bool operator==(Rcpp::Na_Proxy, int x ){ return Rcpp::traits::is_na<INTSXP>(x) ; }
40+
friend inline bool operator==(Rcpp::Na_Proxy, Rcpp::String x ){ return Rcpp::traits::is_na<STRSXP>(x.get_sexp()) ; }
41+
friend inline bool operator==(Rcpp::Na_Proxy, SEXP x ){ return TYPEOF(x)==CHARSXP && Rcpp::traits::is_na<STRSXP>(x) ; }
42+
friend inline bool operator==(Rcpp::Na_Proxy, Rcomplex x ){ return Rcpp::traits::is_na<CPLXSXP>(x) ; }
43+
friend inline bool operator==(Rcpp::Na_Proxy, std::string ){ return false ; }
44+
friend inline bool operator==(Rcpp::Na_Proxy, const char* ){ return false ; }
45+
friend inline bool operator==(Rcpp::Na_Proxy, Rcpp::internal::string_proxy<STRSXP> x){
46+
return Rcpp::traits::is_na<STRSXP>(x.get()) ;
47+
}
48+
friend inline bool operator==(Rcpp::Na_Proxy, Rcpp::internal::const_string_proxy<STRSXP> x){
49+
return Rcpp::traits::is_na<STRSXP>(x.get()) ;
50+
}
51+
} ;
2352
static Na_Proxy NA ;
24-
}
25-
26-
inline bool operator==(double x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<REALSXP>(x) ; }
27-
inline bool operator==(int x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<INTSXP>(x) ; }
28-
inline bool operator==(Rcpp::String x, Rcpp::Na_Proxy){ return Rcpp::traits::is_na<STRSXP>(x.get_sexp()) ; }
29-
inline bool operator==(Rcomplex x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<CPLXSXP>(x) ; }
30-
inline bool operator==(SEXP x , Rcpp::Na_Proxy){ return TYPEOF(x)==CHARSXP && Rcpp::traits::is_na<STRSXP>(x) ; }
31-
inline bool operator==(std::string , Rcpp::Na_Proxy){ return false ; }
32-
inline bool operator==(const char* , Rcpp::Na_Proxy){ return false ; }
33-
inline bool operator==(Rcpp::internal::string_proxy<STRSXP> x, Rcpp::Na_Proxy){
34-
return Rcpp::traits::is_na<STRSXP>(x.get()) ;
35-
}
36-
inline bool operator==(Rcpp::internal::const_string_proxy<STRSXP> x, Rcpp::Na_Proxy){
37-
return Rcpp::traits::is_na<STRSXP>(x.get()) ;
38-
}
3953

40-
inline bool operator==(Rcpp::Na_Proxy, double x ){ return Rcpp::traits::is_na<REALSXP>(x) ; }
41-
inline bool operator==(Rcpp::Na_Proxy, int x ){ return Rcpp::traits::is_na<INTSXP>(x) ; }
42-
inline bool operator==(Rcpp::Na_Proxy, Rcpp::String x ){ return Rcpp::traits::is_na<STRSXP>(x.get_sexp()) ; }
43-
inline bool operator==(Rcpp::Na_Proxy, SEXP x ){ return TYPEOF(x)==CHARSXP && Rcpp::traits::is_na<STRSXP>(x) ; }
44-
inline bool operator==(Rcpp::Na_Proxy, Rcomplex x ){ return Rcpp::traits::is_na<CPLXSXP>(x) ; }
45-
inline bool operator==(Rcpp::Na_Proxy, std::string ){ return false ; }
46-
inline bool operator==(Rcpp::Na_Proxy, const char* ){ return false ; }
47-
inline bool operator==(Rcpp::Na_Proxy, Rcpp::internal::string_proxy<STRSXP> x){
48-
return Rcpp::traits::is_na<STRSXP>(x.get()) ;
49-
}
50-
inline bool operator==(Rcpp::Na_Proxy, Rcpp::internal::const_string_proxy<STRSXP> x){
51-
return Rcpp::traits::is_na<STRSXP>(x.get()) ;
54+
inline LogicalVector shush_about_NA(){
55+
return LogicalVector::create(
56+
_["int"] = NA == NA_INTEGER,
57+
_["double"] = NA == NA_REAL,
58+
_["string"] = NA == NA_STRING
59+
) ;
60+
}
5261
}
53-
5462
#endif

0 commit comments

Comments
 (0)