[Rcpp-commits] r592 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 6 11:53:59 CET 2010


Author: romain
Date: 2010-02-06 11:53:56 +0100 (Sat, 06 Feb 2010)
New Revision: 592

Modified:
   pkg/src/Dimension.cpp
Log:
use wrap to avoid code repetition

Modified: pkg/src/Dimension.cpp
===================================================================
--- pkg/src/Dimension.cpp	2010-02-06 10:48:19 UTC (rev 591)
+++ pkg/src/Dimension.cpp	2010-02-06 10:53:56 UTC (rev 592)
@@ -45,10 +45,7 @@
 	}
 	
 	Dimension::operator SEXP() const {
-		SEXP x = PROTECT(Rf_allocVector(INTSXP,dims.size())) ;
-		std::copy( dims.begin(), dims.end(), INTEGER(x) ) ;
-		UNPROTECT(1) ; /* x */
-		return x ;
+		return wrap( dims.begin(), dims.end() ) ;
 	}
 	
 	int Dimension::size() const {



More information about the Rcpp-commits mailing list