[Rcpp-commits] r981 - in pkg/Rcpp: . inst inst/include/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 4 15:59:04 CEST 2010


Author: romain
Date: 2010-04-04 15:59:04 +0200 (Sun, 04 Apr 2010)
New Revision: 981

Modified:
   pkg/Rcpp/DESCRIPTION
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/Vector.h
Log:
document the header relocation and add templated Vector::operator=

Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION	2010-04-04 13:26:25 UTC (rev 980)
+++ pkg/Rcpp/DESCRIPTION	2010-04-04 13:59:04 UTC (rev 981)
@@ -1,6 +1,6 @@
 Package: Rcpp
 Title: Rcpp R/C++ interface package
-Version: 0.7.11.1
+Version: 0.7.11.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/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-04-04 13:26:25 UTC (rev 980)
+++ pkg/Rcpp/inst/ChangeLog	2010-04-04 13:59:04 UTC (rev 981)
@@ -1,3 +1,18 @@
+2010-04-4	Romain Francois <romain at r-enthusiasts.com>
+
+	* inst/include/* : headers are moved to inst/include so that they are 
+	are not duplicated on multi arch platforms
+
+	* R/RcppLdPath.R: RcppCxxFlags is updated to reflect the above change
+
+	* src/Makevars: simplified as the headers don't need to be copied to each 
+	arch lib directory anymore
+
+	* src/Makevars.win: same
+
+	* inst/include/Rcpp/Vector.h : Vector<> gains a templated assignment 
+	operator 
+	
 2010-04-2	Romain Francois <romain at r-enthusiasts.com>
 
 	* src/Rcpp/Formula.h: new Rcpp::Formula class

Modified: pkg/Rcpp/inst/include/Rcpp/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Vector.h	2010-04-04 13:26:25 UTC (rev 980)
+++ pkg/Rcpp/inst/include/Rcpp/Vector.h	2010-04-04 13:59:04 UTC (rev 981)
@@ -415,7 +415,7 @@
 		typedef typename storage_type<RTYPE>::type type ;
 	} ;
 	template<> struct init_type<STRSXP>{
-		typedef std::string type ;
+		typedef const char* type ;
 	} ;
 	template<> struct init_type<LGLSXP>{
 		typedef bool type ;
@@ -491,6 +491,17 @@
 		return *this ;
 	}
 	
+	template <typename T>
+	Vector& operator=( const T& x){
+		Base::setSEXP( r_cast<RTYPE>( wrap(x) ) ) ;
+		return *this ;
+	}
+
+	internal::ListInitialization<iterator,init_type> operator=( init_type x){
+		iterator start = begin() ; *start = x; 
+		return internal::ListInitialization<iterator,init_type>( start + 1 ) ; ;
+	}
+	
     Vector( SEXP x ) : Base() {
     	RCPP_DEBUG( "Vector<%d>( SEXP = <%p> )", RTYPE, x) ;
     	Base::setSEXP( r_cast<RTYPE>( x ) ) ;
@@ -525,12 +536,7 @@
 		}
     }
     
-    
-    internal::ListInitialization<iterator,init_type> operator=( init_type x){
-		iterator start = begin() ; *start = x; 
-		return internal::ListInitialization<iterator,init_type>( start + 1 ) ; ;
-	}
-	
+   
 	template <typename InputIterator>
 	Vector( InputIterator first, InputIterator last) : Base(){
 		assign( first, last ) ;



More information about the Rcpp-commits mailing list