[Rcpp-commits] r916 - in pkg/Rcpp: . inst inst/unitTests src src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 19 13:24:08 CET 2010


Author: romain
Date: 2010-03-19 13:24:08 +0100 (Fri, 19 Mar 2010)
New Revision: 916

Removed:
   pkg/Rcpp/inst/unitTests/runit.make.list.R
   pkg/Rcpp/src/Rcpp/make_list.h
   pkg/Rcpp/src/make_list.cpp
Modified:
   pkg/Rcpp/DESCRIPTION
   pkg/Rcpp/NEWS
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/unitTests/runit.Vector.create.R
   pkg/Rcpp/src/Rcpp.h
   pkg/Rcpp/src/Rcpp/Vector.h
Log:
code bloat for Vector::create, now handling up to 20 arguments, and using TMP dispatch to simplify when there are no names, make_list is removed

Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION	2010-03-19 09:55:50 UTC (rev 915)
+++ pkg/Rcpp/DESCRIPTION	2010-03-19 12:24:08 UTC (rev 916)
@@ -1,6 +1,6 @@
 Package: Rcpp
 Title: Rcpp R/C++ interface package
-Version: 0.7.10.1
+Version: 0.7.10.2
 Date: $Date$
 Author: Dirk Eddelbuettel and Romain Francois, with contributions 
  by Simon Urbanek, David Reiss and Douglas Bates; based on code written during 

Modified: pkg/Rcpp/NEWS
===================================================================
--- pkg/Rcpp/NEWS	2010-03-19 09:55:50 UTC (rev 915)
+++ pkg/Rcpp/NEWS	2010-03-19 12:24:08 UTC (rev 916)
@@ -1,12 +1,11 @@
 0.7.11	(under develpment)
 
-	o	new templated functions Rcpp::make_list taking up to 20 arguments
-	and creating a generic vector
+	o	Vector<> gains a set of templated factory methods "create". create 
+	takes up to 20 arguments and can create named or unnamed vectors. 
 	
 	o	new class Rcpp::Argument, similar to Named but it does not hold the 
-	object, only the name. This allows a package to pre-declare a set of 
-	arguments it typically uses and have a nicer construct. An example is 
-	given in the runit.Argument.R file
+	object, only the name. Argument is used in the create factory methods 
+	to associate a name with a value.
 
 0.7.10  2010-03-15
 

Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-03-19 09:55:50 UTC (rev 915)
+++ pkg/Rcpp/inst/ChangeLog	2010-03-19 12:24:08 UTC (rev 916)
@@ -1,3 +1,12 @@
+2010-03-19  Romain Francois <romain at r-enthusiasts.com>
+
+	* src/Rcpp/Vector.h: Vector gains the "create" factory methods taking up 
+	to 20 arguments that can be named (using the Argument class or the _ 
+	placeholder)
+	
+	* src/Rcpp/make_list.h: removed since Vector::create does the job more generically
+	and more efficently
+
 2010-03-16  Romain Francois <romain at r-enthusiasts.com>
 
 	* src/Rcpp/make_list.h: set of helper factories make_list to facilitate 

Modified: pkg/Rcpp/inst/unitTests/runit.Vector.create.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Vector.create.R	2010-03-19 09:55:50 UTC (rev 915)
+++ pkg/Rcpp/inst/unitTests/runit.Vector.create.R	2010-03-19 12:24:08 UTC (rev 916)
@@ -24,40 +24,47 @@
 test.IntegerVector.create <- function(){
 	fx <- cfunction(signature(), '
 	List output(2); 
-	output[0] = IntegerVector::create( 10 ) ;
-	output[1] = IntegerVector::create( _["foo"] = 20 ) ;
+	output[0] = IntegerVector::create( 10, 20 ) ;
+	output[1] = IntegerVector::create( 
+		_["foo"] = 20, 
+		_["bar"] = 30 ) ;
 	return output ;
 	', 
 	Rcpp = TRUE, includes = "using namespace Rcpp;" )
 	
-	checkEquals( fx(), list( 10L, c(foo = 20L ) ), 
+	checkEquals( fx(), list( c( 10L, 20L) , c(foo = 20L, bar = 30L) ), 
 		msg = "IntegerVector::create" )
 }
 
 test.List.create <- function(){
 	fx <- cfunction(signature(), '
 	List output(2); 
-	output[0] = List::create( 10 ) ;
-	output[1] = List::create( _["foo"] = "bar" ) ;
+	output[0] = List::create( 10, "foo" ) ;
+	output[1] = List::create( 
+		_["foo"] = 10, 
+		_["bar"] = true ) ;
 	return output ;
 	', 
 	Rcpp = TRUE, includes = "using namespace Rcpp;" )
 	
-	checkEquals( fx(), list( list( 10L ), list(foo = "bar" ) ), 
+	checkEquals( fx(), list( list( 10L, "foo" ), list(foo = 10L, bar =  TRUE ) ), 
 		msg = "List::create" )
 }
 
 test.CharacterVector.create <- function(){
 	fx <- cfunction(signature(), '
 	List output(2); 
-	output[0] = CharacterVector::create( "foo" ) ;
-	output[1] = CharacterVector::create( _["foo"] = "bar" ) ;
+	output[0] = CharacterVector::create( "foo", "bar" ) ;
+	output[1] = CharacterVector::create( 
+		_["foo"] = "bar", 
+		_["bar"] = "foo"
+		) ;
 	return output ;
 	', 
 	Rcpp = TRUE, includes = "using namespace Rcpp;" )
-	                          
-	checkEquals( fx(), list( "foo", c(foo = "bar" ) ), 
-		msg = "CharacterVector::create" )
 	
+	checkEquals( fx(), list( c( "foo", "bar" ), c(foo = "bar", bar = "foo" ) ), 
+	 	msg = "CharacterVector::create" )
+	
 }
 

Deleted: pkg/Rcpp/inst/unitTests/runit.make.list.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.make.list.R	2010-03-19 09:55:50 UTC (rev 915)
+++ pkg/Rcpp/inst/unitTests/runit.make.list.R	2010-03-19 12:24:08 UTC (rev 916)
@@ -1,64 +0,0 @@
-#!/usr/bin/r -t
-#
-# Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
-#
-# This file is part of Rcpp.
-#
-# Rcpp is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# Rcpp is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-.setUp <- function(){
-	suppressMessages( require( inline ) )
-}
-
-test.make.list.no.names <- function(){
-	
-	fx <- cfunction(signature(),'
-		return make_list( 1, 2, "foobar", 4.0 ) ;	
-	', 
-	Rcpp = TRUE, includes = "using namespace Rcpp; " )
-	res <- fx()
-	checkEquals( res, list( 1L, 2L, "foobar", 4.0 ), msg = "unnamed make.list" )
-	checkTrue( is.null(names(res)), msg = "unnamed make.list, no names" )
-}
-
-test.make.list.with.names <- function(){
-	
-	fx <- cfunction(signature(),'
-		return make_list( 
-			Named("a") = 1 , 
-			Named("b") = 2 , 
-			Named("c") = "foobar", 
-			Named("d") = 4.0 ) ;	
-	', 
-	Rcpp = TRUE, includes = "using namespace Rcpp; " )
-	res <- fx()
-	checkEquals( res, 
-		list( a = 1L, b = 2L, c = "foobar", d = 4.0 ), msg = "named make.list" )
-}
-
-test.make.list.some.names <- function(){
-	
-	fx <- cfunction(signature(),'
-		return make_list( 
-			Named("a") = 1 , 
-			2 , 
-			"foobar", 
-			Named("d") = 4.0 ) ;	
-	', 
-	Rcpp = TRUE, includes = "using namespace Rcpp; " )
-	res <- fx()
-	checkEquals( res, 
-		list( a = 1L, 2L, "foobar", d = 4.0 ), msg = "named make.list" )
-}
-

Modified: pkg/Rcpp/src/Rcpp/Vector.h
===================================================================
--- pkg/Rcpp/src/Rcpp/Vector.h	2010-03-19 09:55:50 UTC (rev 915)
+++ pkg/Rcpp/src/Rcpp/Vector.h	2010-03-19 12:24:08 UTC (rev 916)
@@ -201,14 +201,13 @@
 	class element_converter{
 	public:
 		typedef typename ::Rcpp::traits::storage_type<RTYPE>::type target ;
-		element_converter(){}
 		
 		template <typename T>
-		target get( const T& input ){
+		static target get( const T& input ){
 			return caster<T,target>(input) ;
 		}
 		
-		target get( const target& input ){
+		static target get( const target& input ){
 			return input ;
 		}
 	} ;
@@ -218,19 +217,17 @@
 	public:
 		typedef SEXP target ;
 		
-		string_element_converter(){};
-		
 		template <typename T>
-		SEXP get( const T& input){
+		static SEXP get( const T& input){
 			std::string out(input) ;
 			return Rf_mkChar( out.c_str() ) ;
 		}
 		
-		SEXP get(const std::string& input){
+		static SEXP get(const std::string& input){
 			return Rf_mkChar( input.c_str() ) ;
 		}
 		
-		SEXP get(const char& input){
+		static SEXP get(const char& input){
 			return Rf_mkChar( &input ) ;
 		}
 	} ;
@@ -239,18 +236,17 @@
 	class generic_element_converter {
 	public:
 		typedef SEXP target ;
-		generic_element_converter(){};
 		
 		template <typename T>
-		SEXP get( const T& input){
+		static SEXP get( const T& input){
 			return ::Rcpp::wrap( input ) ;
 		}
 		
-		SEXP get( const char* input){
+		static SEXP get( const char* input){
 			return ::Rcpp::wrap( input );
 		}
 		
-		SEXP get(SEXP input){
+		static SEXP get(SEXP input){
 			return input ;
 		}
 	} ;
@@ -638,33 +634,33 @@
 	
 	template <typename T>
 	void push_back( const T& object){
-		push_back__impl( converter.get(object) ) ;
+		push_back__impl( converter_type::get(object) ) ;
 	}
 	
 	template <typename T>
 	void push_back( const T& object, const std::string& name ){
-		push_back_name__impl( converter.get(object), name ) ;
+		push_back_name__impl( converter_type::get(object), name ) ;
 	}
 	
 	template <typename T>
 	void push_front( const T& object){
-		push_front__impl( converter.get(object) ) ;
+		push_front__impl( converter_type::get(object) ) ;
 	}
 	
 	template <typename T>
 	void push_front( const T& object, const std::string& name){
-		push_front_name__impl( converter.get(object), name ) ;
+		push_front_name__impl( converter_type::get(object), name ) ;
 	}
 	
 	
 	template <typename T>
 	iterator insert( iterator position, const T& object){
-		return insert__impl( position, converter.get(object) ) ;
+		return insert__impl( position, converter_type::get(object) ) ;
 	}
 	
 	template <typename T>
 	iterator insert( int position, const T& object){
-		return insert__impl( cache.get(position), converter.get(object) ); 
+		return insert__impl( cache.get(position), converter_type::get(object) ); 
 	}
 	
 	iterator erase( int position){
@@ -686,42 +682,1211 @@
 	void update_vector(){ 
 		cache.update(*this) ;
 	}
+
+/* <code-bloat>
+
+public:
 	
+	template <TYPENAMES>
+	static Vector create(ARGUMENTS){
+		return create__dispatch( typename traits::integral_constant<bool, 
+			__OR__{{  traits::is_named<___T___>::value  }}
+		>::type(), PARAMETERS ) ;  		
+	}
+	
+private:
+	
+	template <TYPENAMES>
+	static Vector create__dispatch( traits::false_type, ARGUMENTS ){
+		Vector res(___N___) ;
+		iterator it( res.begin() );
+		
+		////
+		__FOR_EACH__{{ *it = converter_type::get(___X___) ; ++it ; }}
+		////
+		
+		return res ;
+	}
+	
+	template <TYPENAMES>
+	static Vector create__dispatch( traits::true_type, ARGUMENTS){
+		Vector res( ___N___ ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, ___N___ ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+		__FOR_EACH__{{ replace_element( it, names, index, ___X___ ) ; ++it; ++index ; }}
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+*/
+public:
+	
 	template <typename T1>
-	static SEXP create( const T1& t1){
-		return create__dispatch( typename traits::integral_constant< bool, traits::is_named<T1>::value >::type(), t1 ) ;  		
+	static Vector create(const T1& t1){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  
+		>::type(), t1 ) ;  		
 	}
 	
 private:
 	
 	template <typename T1>
-	static SEXP create__dispatch( traits::false_type, const T1& t1 ){
+	static Vector create__dispatch( traits::false_type, const T1& t1 ){
 		Vector res(1) ;
 		iterator it( res.begin() );
 		
 		////
-		*it = converter.get(t1) ; ++it ;
-		//// 
+ *it = converter_type::get(t1) ; ++it ; 
+		////
 		
 		return res ;
 	}
 	
 	template <typename T1>
-	static SEXP create__dispatch( traits::true_type, const T1& t1){
-		Vector res(1) ;                                                                      
+	static Vector create__dispatch( traits::true_type, const T1& t1){
+		Vector res( 1 ) ;                                                                      
 		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 1 ) ) ;
 		int index = 0 ;
 		iterator it( res.begin() );
 		
 		////
-		replace_element( it, names, index, t1 ) ; ++it; ++index ;
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
 		////
 		
 		res.attr("names") = names ;
 		UNPROTECT(1); // names
 		return res ;
 	}
+
+public:
 	
+	template <typename T1, typename T2>
+	static Vector create(const T1& t1, const T2& t2){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  
+		>::type(), t1, t2 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2 ){
+		Vector res(2) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2){
+		Vector res( 2 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 2 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  ||  traits::is_named<T3>::value  
+		>::type(), t1, t2, t3 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2, typename T3>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2, const T3& t3 ){
+		Vector res(3) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+ *it = converter_type::get(t3) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2, typename T3>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2, const T3& t3){
+		Vector res( 3 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 3 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t3 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3, typename T4>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3, const T4& t4){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  ||  traits::is_named<T3>::value  ||  traits::is_named<T4>::value  
+		>::type(), t1, t2, t3, t4 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2, typename T3, typename T4>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4 ){
+		Vector res(4) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+ *it = converter_type::get(t3) ; ++it ; 
+ *it = converter_type::get(t4) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2, typename T3, typename T4>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4){
+		Vector res( 4 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 4 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t3 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t4 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  ||  traits::is_named<T3>::value  ||  traits::is_named<T4>::value  ||  traits::is_named<T5>::value  
+		>::type(), t1, t2, t3, t4, t5 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5 ){
+		Vector res(5) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+ *it = converter_type::get(t3) ; ++it ; 
+ *it = converter_type::get(t4) ; ++it ; 
+ *it = converter_type::get(t5) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5){
+		Vector res( 5 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 5 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t3 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t4 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t5 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  ||  traits::is_named<T3>::value  ||  traits::is_named<T4>::value  ||  traits::is_named<T5>::value  ||  traits::is_named<T6>::value  
+		>::type(), t1, t2, t3, t4, t5, t6 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6 ){
+		Vector res(6) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+ *it = converter_type::get(t3) ; ++it ; 
+ *it = converter_type::get(t4) ; ++it ; 
+ *it = converter_type::get(t5) ; ++it ; 
+ *it = converter_type::get(t6) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6){
+		Vector res( 6 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 6 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t3 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t4 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t5 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t6 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  ||  traits::is_named<T3>::value  ||  traits::is_named<T4>::value  ||  traits::is_named<T5>::value  ||  traits::is_named<T6>::value  ||  traits::is_named<T7>::value  
+		>::type(), t1, t2, t3, t4, t5, t6, t7 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7 ){
+		Vector res(7) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+ *it = converter_type::get(t3) ; ++it ; 
+ *it = converter_type::get(t4) ; ++it ; 
+ *it = converter_type::get(t5) ; ++it ; 
+ *it = converter_type::get(t6) ; ++it ; 
+ *it = converter_type::get(t7) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7){
+		Vector res( 7 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 7 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t3 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t4 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t5 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t6 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t7 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  ||  traits::is_named<T3>::value  ||  traits::is_named<T4>::value  ||  traits::is_named<T5>::value  ||  traits::is_named<T6>::value  ||  traits::is_named<T7>::value  ||  traits::is_named<T8>::value  
+		>::type(), t1, t2, t3, t4, t5, t6, t7, t8 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8 ){
+		Vector res(8) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+ *it = converter_type::get(t3) ; ++it ; 
+ *it = converter_type::get(t4) ; ++it ; 
+ *it = converter_type::get(t5) ; ++it ; 
+ *it = converter_type::get(t6) ; ++it ; 
+ *it = converter_type::get(t7) ; ++it ; 
+ *it = converter_type::get(t8) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8){
+		Vector res( 8 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 8 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t3 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t4 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t5 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t6 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t7 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t8 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  ||  traits::is_named<T3>::value  ||  traits::is_named<T4>::value  ||  traits::is_named<T5>::value  ||  traits::is_named<T6>::value  ||  traits::is_named<T7>::value  ||  traits::is_named<T8>::value  ||  traits::is_named<T9>::value  
+		>::type(), t1, t2, t3, t4, t5, t6, t7, t8, t9 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9 ){
+		Vector res(9) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+ *it = converter_type::get(t3) ; ++it ; 
+ *it = converter_type::get(t4) ; ++it ; 
+ *it = converter_type::get(t5) ; ++it ; 
+ *it = converter_type::get(t6) ; ++it ; 
+ *it = converter_type::get(t7) ; ++it ; 
+ *it = converter_type::get(t8) ; ++it ; 
+ *it = converter_type::get(t9) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9){
+		Vector res( 9 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 9 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t3 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t4 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t5 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t6 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t7 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t8 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t9 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  ||  traits::is_named<T3>::value  ||  traits::is_named<T4>::value  ||  traits::is_named<T5>::value  ||  traits::is_named<T6>::value  ||  traits::is_named<T7>::value  ||  traits::is_named<T8>::value  ||  traits::is_named<T9>::value  ||  traits::is_named<T10>::value  
+		>::type(), t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10 ){
+		Vector res(10) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+ *it = converter_type::get(t3) ; ++it ; 
+ *it = converter_type::get(t4) ; ++it ; 
+ *it = converter_type::get(t5) ; ++it ; 
+ *it = converter_type::get(t6) ; ++it ; 
+ *it = converter_type::get(t7) ; ++it ; 
+ *it = converter_type::get(t8) ; ++it ; 
+ *it = converter_type::get(t9) ; ++it ; 
+ *it = converter_type::get(t10) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10){
+		Vector res( 10 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 10 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t3 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t4 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t5 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t6 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t7 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t8 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t9 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t10 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11){
+		return create__dispatch( typename traits::integral_constant<bool, 
+  traits::is_named<T1>::value  ||  traits::is_named<T2>::value  ||  traits::is_named<T3>::value  ||  traits::is_named<T4>::value  ||  traits::is_named<T5>::value  ||  traits::is_named<T6>::value  ||  traits::is_named<T7>::value  ||  traits::is_named<T8>::value  ||  traits::is_named<T9>::value  ||  traits::is_named<T10>::value  ||  traits::is_named<T11>::value  
+		>::type(), t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11 ) ;  		
+	}
+	
+private:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
+	static Vector create__dispatch( traits::false_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11 ){
+		Vector res(11) ;
+		iterator it( res.begin() );
+		
+		////
+ *it = converter_type::get(t1) ; ++it ; 
+ *it = converter_type::get(t2) ; ++it ; 
+ *it = converter_type::get(t3) ; ++it ; 
+ *it = converter_type::get(t4) ; ++it ; 
+ *it = converter_type::get(t5) ; ++it ; 
+ *it = converter_type::get(t6) ; ++it ; 
+ *it = converter_type::get(t7) ; ++it ; 
+ *it = converter_type::get(t8) ; ++it ; 
+ *it = converter_type::get(t9) ; ++it ; 
+ *it = converter_type::get(t10) ; ++it ; 
+ *it = converter_type::get(t11) ; ++it ; 
+		////
+		
+		return res ;
+	}
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
+	static Vector create__dispatch( traits::true_type, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11){
+		Vector res( 11 ) ;                                                                      
+		SEXP names = PROTECT( ::Rf_allocVector( STRSXP, 11 ) ) ;
+		int index = 0 ;
+		iterator it( res.begin() );
+		
+		////
+ replace_element( it, names, index, t1 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t2 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t3 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t4 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t5 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t6 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t7 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t8 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t9 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t10 ) ; ++it; ++index ; 
+ replace_element( it, names, index, t11 ) ; ++it; ++index ; 
+		////
+		
+		res.attr("names") = names ;
+		UNPROTECT(1); // names
+		return res ;
+	}
+
+public:
+	
+	template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
+	static Vector create(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12){
+		return create__dispatch( typename traits::integral_constant<bool, 
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rcpp -r 916


More information about the Rcpp-commits mailing list