[Rcpp-commits] r2128 - in pkg/Rcpp: R inst/include/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 17 11:07:18 CEST 2010


Author: romain
Date: 2010-09-17 11:07:17 +0200 (Fri, 17 Sep 2010)
New Revision: 2128

Modified:
   pkg/Rcpp/R/Module.R
   pkg/Rcpp/inst/include/Rcpp/Module.h
Log:
Class__invoke_method does not return a list anymore since we already know about the voidness of the function

Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R	2010-09-17 09:00:14 UTC (rev 2127)
+++ pkg/Rcpp/R/Module.R	2010-09-17 09:07:17 UTC (rev 2128)
@@ -266,16 +266,13 @@
 	voidness <- .Call( "CppClass__methods_voidness", xp, PACKAGE = "Rcpp" )
 	
 	mets <- sapply( met, function( m ){
-	    # skeleton
+	    # skeleton that gets modified below
 	    f <- function( ){
 	        res <- .External( "Class__invoke_method", .self at cppclass , m, .self at pointer, PACKAGE = "Rcpp" )
-	        # TODO: update Class__invoke_method so that it does not create a list
-	        #       list( void, result ) since we already know that information
-	        res$result
+	        res
 	    }
 	    body( f )[[2]][[3]][[4]] <- m 
 	    
-	    
 	    if( ar <- arity[[ m ]] ){
 	        # change the formal arguments
 	        formals( f ) <- structure( rep( alist( . = ), ar ), names = sprintf( "x%d", seq_len(ar) ) )

Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h	2010-09-17 09:00:14 UTC (rev 2127)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h	2010-09-17 09:07:17 UTC (rev 2128)
@@ -215,10 +215,7 @@
 		if( met->nargs() > nargs ){
 			throw std::range_error( "incorrect number of arguments" ) ; 	
 		}
-		return Rcpp::List::create( 
-				Rcpp::Named("result") = met->operator()( XP(object), args ), 
-				Rcpp::Named("void")   = met->is_void() 
-			) ;
+		return met->operator()( XP(object), args ) ;
 		END_RCPP	
 	}
 	



More information about the Rcpp-commits mailing list