[Rcpp-commits] r3440 - in pkg/Rcpp: . inst/include/Rcpp/vector inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 15 11:42:25 CET 2012


Author: romain
Date: 2012-01-15 11:42:22 +0100 (Sun, 15 Jan 2012)
New Revision: 3440

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
   pkg/Rcpp/inst/unitTests/runit.Vector.R
Log:
fixing issue reported by gregor kastner

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2012-01-12 05:39:12 UTC (rev 3439)
+++ pkg/Rcpp/ChangeLog	2012-01-15 10:42:22 UTC (rev 3440)
@@ -1,3 +1,9 @@
+2012-01-15  Romain Francois  <romain at r-enthusiasts.com>
+
+        * inst/include/Rcpp/vector/Vector.h: fixing IntegerVector(int,int), reported
+	  by Gregor Kastner on rcpp-devel
+        * inst/unitTests/runit.Vector.R: regression test for the above
+
 2011-12-25  Dirk Eddelbuettel  <edd at debian.org>
 
         * DESCRIPTION: Release 0.9.9

Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2012-01-12 05:39:12 UTC (rev 3439)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2012-01-15 10:42:22 UTC (rev 3440)
@@ -198,6 +198,11 @@
     	RObject::setSEXP( Rf_allocVector( RTYPE, size) ) ;
         fill_or_generate( u ) ;	
     }
+    
+    Vector( const int& size, const stored_type& u ){
+        RObject::setSEXP( Rf_allocVector( RTYPE, size) ) ;
+        fill( u ) ;
+    }
 
     Vector( const int& siz, stored_type (*gen)(void) ){
     	RObject::setSEXP( Rf_allocVector( RTYPE, siz) ) ;

Modified: pkg/Rcpp/inst/unitTests/runit.Vector.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Vector.R	2012-01-12 05:39:12 UTC (rev 3439)
+++ pkg/Rcpp/inst/unitTests/runit.Vector.R	2012-01-15 10:42:22 UTC (rev 3440)
@@ -605,6 +605,13 @@
 	                    StringVector s(x) ;
 	                    return s; 
 	                '
+	            ), 
+	            "IntegerVector_int_init" = list( 
+	                signature(), 
+	                '
+	                    IntegerVector x(2,4) ;
+	                    return x ;
+	                '
 	            )
                   
         )
@@ -1256,3 +1263,9 @@
     y <- fun(x)
     checkEquals( y, as.character(x) )
 }
+
+test.IntegerVector_int_init <- function(){
+    fun <-    .rcpp.Vector$IntegerVector_int_init
+    checkEquals( fun(), c(4L,4L), msg = "IntegerVector int init regression test" )
+}
+



More information about the Rcpp-commits mailing list