[Rcpp-commits] r4041 - in pkg/Rcpp: . inst/include/Rcpp inst/include/Rcpp/stats/random inst/include/Rcpp/sugar/functions inst/include/Rcpp/vector
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Nov 26 10:44:11 CET 2012
Author: romain
Date: 2012-11-26 10:44:11 +0100 (Mon, 26 Nov 2012)
New Revision: 4041
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/inst/include/Rcpp/Module.h
pkg/Rcpp/inst/include/Rcpp/stats/random/rbeta.h
pkg/Rcpp/inst/include/Rcpp/sugar/functions/clamp.h
pkg/Rcpp/inst/include/Rcpp/sugar/functions/pmax.h
pkg/Rcpp/inst/include/Rcpp/sugar/functions/pmin.h
pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
Log:
fix issues reported by clang
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2012-11-25 15:55:33 UTC (rev 4040)
+++ pkg/Rcpp/ChangeLog 2012-11-26 09:44:11 UTC (rev 4041)
@@ -1,3 +1,12 @@
+2012-11-26 Romain Francois <romain at r-enthusiasts.com>
+
+ * include/Rcpp/Module.h: comment out the unused and unuseable converter
+ overload.
+ * include/Rcpp/sugar/functions/pmin.h: be consistent about how the
+ pmin_op helper struct is defined (always a struct).
+ * include/Rcpp/sugar/functions/pmax.h: same for pmax
+ * include/Rcpp/stats/random/rbeta.h: fixed constructor issue
+
2012-11-25 JJ Allaire <jj at rstudio.org>
* R/Attributes.R: use echo = TRUE for sourceCpp R code chunks
Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h 2012-11-25 15:55:33 UTC (rev 4040)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h 2012-11-26 09:44:11 UTC (rev 4041)
@@ -356,12 +356,13 @@
std::string fun_name = internal::get_converter_name<FROM,TO>( from, to ) ;
function( fun_name.c_str(), fun, docstring ) ;
}
-
- template <typename FROM, typename TO>
- void converter( const char* /* from */ , const char* to, TO (FROM::*fun)(), const char* docstring = 0 ){
- Rcpp::Module* scope = ::getCurrentScope() ;
- class_<FROM>().convert_to( to, fun, docstring ) ;
- }
+
+ // commented out as there is no convert_to in class_
+ //
+ // template <typename FROM, typename TO>
+ // void converter( const char* /* from */ , const char* to, TO (FROM::*fun)(), const char* docstring = 0 ){
+ // class_<FROM>().convert_to( to, fun, docstring ) ;
+ // }
class CppClass : public S4{
Modified: pkg/Rcpp/inst/include/Rcpp/stats/random/rbeta.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/random/rbeta.h 2012-11-25 15:55:33 UTC (rev 4040)
+++ pkg/Rcpp/inst/include/Rcpp/stats/random/rbeta.h 2012-11-26 09:44:11 UTC (rev 4041)
@@ -28,7 +28,7 @@
template <bool seed>
class BetaGenerator : public Generator<seed,double>{
public:
- BetaGenerator(double a_, double b_) : a(a), b(b_){}
+ BetaGenerator(double a_, double b_) : a(a_), b(b_){}
inline double operator()() const {
return ::Rf_rbeta(a, b) ;
Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/clamp.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/clamp.h 2012-11-25 15:55:33 UTC (rev 4040)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/clamp.h 2012-11-26 09:44:11 UTC (rev 4041)
@@ -36,13 +36,13 @@
}
STORAGE lhs, rhs ;
} ;
-// need to write this qpecial version
+// need to write this special version
template <>
struct clamp_operator<REALSXP,true> {
clamp_operator(double lhs_, double rhs_ ) : lhs(lhs_), rhs(rhs_){}
inline double operator()(double x) const {
- if( Rcpp::traits::is_na<REALSXP>(x) ) ;
+ if( Rcpp::traits::is_na<REALSXP>(x) ) return x ;
return lhs < x ? lhs : (x < rhs ? x : rhs ) ;
}
double lhs, rhs ;
Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/pmax.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/pmax.h 2012-11-25 15:55:33 UTC (rev 4040)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/pmax.h 2012-11-26 09:44:11 UTC (rev 4041)
@@ -25,7 +25,7 @@
namespace Rcpp{
namespace sugar{
-template <int RTYPE, bool LHS_NA, bool RHS_NA> class pmax_op ;
+template <int RTYPE, bool LHS_NA, bool RHS_NA> struct pmax_op ;
// specializations for double.
// we use the fact that NA < x is false
Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/pmin.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/pmin.h 2012-11-25 15:55:33 UTC (rev 4040)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/pmin.h 2012-11-26 09:44:11 UTC (rev 4041)
@@ -25,7 +25,7 @@
namespace Rcpp{
namespace sugar{
-template <int RTYPE, bool LHS_NA, bool RHS_NA> class pmin_op ;
+template <int RTYPE, bool LHS_NA, bool RHS_NA> struct pmin_op ;
// specializations for double.
// we use the fact that NA < x is false
Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2012-11-25 15:55:33 UTC (rev 4040)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2012-11-26 09:44:11 UTC (rev 4041)
@@ -393,19 +393,19 @@
inline const_iterator end() const{ return cache.get_const() + size() ; }
inline Proxy operator[]( int i ){ return cache.ref(i) ; }
- inline Proxy operator[]( int i ) const { return cache.ref(i) ; }
+ inline const_Proxy operator[]( int i ) const { return cache.ref(i) ; }
+
inline Proxy operator()( const size_t& i) {
return cache.ref( offset(i) ) ;
}
- // TODO: should it be const_Proxy
- inline Proxy operator()( const size_t& i) const {
+ inline const_Proxy operator()( const size_t& i) const {
return cache.ref( offset(i) ) ;
}
+
inline Proxy operator()( const size_t& i, const size_t& j) {
return cache.ref( offset(i,j) ) ;
}
- // TODO: should it be const_Proxy
- inline Proxy operator()( const size_t& i, const size_t& j) const {
+ inline const_Proxy operator()( const size_t& i, const size_t& j) const {
return cache.ref( offset(i,j) ) ;
}
More information about the Rcpp-commits
mailing list