[Rcpp-commits] r3766 - in pkg/Rcpp: . inst/include/Rcpp/sugar/functions
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Sep 7 12:11:00 CEST 2012
Author: romain
Date: 2012-09-07 12:11:00 +0200 (Fri, 07 Sep 2012)
New Revision: 3766
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/inst/include/Rcpp/sugar/functions/sign.h
Log:
Sign<> gets a SEXP operator
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2012-09-06 11:13:48 UTC (rev 3765)
+++ pkg/Rcpp/ChangeLog 2012-09-07 10:11:00 UTC (rev 3766)
@@ -1,3 +1,7 @@
+2012-09-07 Romain Francois <romain at r-enthusiasts.com>
+
+ * inst/include/Rcpp/sugar/functions/sign.h: Sign gets a SEXP operator
+
2012-09-03 Dirk Eddelbuettel <edd at debian.org>
* inst/include/Rcpp/sugar/functions/math.h: Added new sugar
Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/sign.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/sign.h 2012-09-06 11:13:48 UTC (rev 3765)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/sign.h 2012-09-07 10:11:00 UTC (rev 3766)
@@ -2,7 +2,7 @@
//
// sign.h: Rcpp R/C++ interface class library -- sign
//
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
//
// This file is part of Rcpp.
//
@@ -49,14 +49,17 @@
public:
typedef typename Rcpp::VectorBase<RTYPE,NA,T> VEC_TYPE ;
typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE ;
+ typedef int r_import_type ;
Sign( const VEC_TYPE& object_ ) : object(object_){}
inline int operator[]( int i ) const {
- return sign__impl<NA,RTYPE>::get( object[i] );
+ return get(i) ;
}
inline int size() const { return object.size() ; }
-
+
+ operator SEXP() const { return wrap( *this ); }
+ inline int get(int i) const { return sign__impl<NA,RTYPE>::get( object[i] ); }
private:
const VEC_TYPE& object ;
} ;
More information about the Rcpp-commits
mailing list