[Rcpp-commits] r2214 - pkg/Rcpp/inst/include/Rcpp/sugar/functions

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 27 15:43:52 CEST 2010


Author: romain
Date: 2010-09-27 15:43:51 +0200 (Mon, 27 Sep 2010)
New Revision: 2214

Modified:
   pkg/Rcpp/inst/include/Rcpp/sugar/functions/sapply.h
Log:
using Extractor in sapply

Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/sapply.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/sapply.h	2010-09-27 13:34:44 UTC (rev 2213)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/sapply.h	2010-09-27 13:43:51 UTC (rev 2214)
@@ -42,15 +42,17 @@
 	typedef typename Rcpp::traits::r_vector_element_converter<RESULT_R_TYPE>::type converter_type ;
 	typedef typename Rcpp::traits::storage_type<RESULT_R_TYPE>::type STORAGE ;
 	
-	Sapply( const VEC& vec_, Function fun_ ) : vec(vec_), fun(fun_){}
+	typedef typename Rcpp::traits::Extractor< RTYPE, NA, T>::type EXT ;
 	
+	Sapply( const VEC& vec_, Function fun_ ) : vec(vec_.get_ref()), fun(fun_){}
+	
 	inline STORAGE operator[]( int i ) const {
 		return converter_type::get( fun( vec[i] ) );
 	}
 	inline int size() const { return vec.size() ; }
 	         
 private:
-	const VEC& vec ;
+	const EXT& vec ;
 	Function fun ;
 } ;
 	



More information about the Rcpp-commits mailing list