[Rcpp-commits] r1689 - in pkg/Rcpp: inst/include/Rcpp inst/unitTests src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jun 23 21:04:34 CEST 2010
Author: romain
Date: 2010-06-23 21:04:33 +0200 (Wed, 23 Jun 2010)
New Revision: 1689
Modified:
pkg/Rcpp/inst/include/Rcpp/DateVector.h
pkg/Rcpp/inst/unitTests/runit.Date.R
pkg/Rcpp/src/DateVector.cpp
Log:
DateVector gains operator SEXP
Modified: pkg/Rcpp/inst/include/Rcpp/DateVector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/DateVector.h 2010-06-23 19:00:44 UTC (rev 1688)
+++ pkg/Rcpp/inst/include/Rcpp/DateVector.h 2010-06-23 19:04:33 UTC (rev 1689)
@@ -2,7 +2,6 @@
//
// DateVector.h: Rcpp R/C++ interface class library -- Date vector support
//
-// Copyright (C) 2005 - 2006 Dominick Samperi
// Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
//
// This file is part of Rcpp.
@@ -48,7 +47,9 @@
inline const_iterator begin() const { return v.begin() ; }
inline const_iterator end() const { return v.end() ; }
-
+
+ inline operator SEXP() const { return wrap( v ) ; }
+
private:
std::vector<Date> v;
};
Modified: pkg/Rcpp/inst/unitTests/runit.Date.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Date.R 2010-06-23 19:00:44 UTC (rev 1688)
+++ pkg/Rcpp/inst/unitTests/runit.Date.R 2010-06-23 19:04:33 UTC (rev 1689)
@@ -61,3 +61,13 @@
checkEquals(fx(), rep(as.Date("2005-12-31"),2), msg = "Date.vector")
}
+test.vector.operator.SEXP <- function(){
+ fx <- cxxfunction( , '
+ DateVector v(2) ;
+ v[0] = Date(2005,12,31) ;
+ v[1] = Date(12,31,2005) ;
+ return v ;
+ ', plugin = "Rcpp" )
+ checkEquals(fx(), rep(as.Date("2005-12-31"),2), msg = "Date.vector")
+}
+
Modified: pkg/Rcpp/src/DateVector.cpp
===================================================================
--- pkg/Rcpp/src/DateVector.cpp 2010-06-23 19:00:44 UTC (rev 1688)
+++ pkg/Rcpp/src/DateVector.cpp 2010-06-23 19:04:33 UTC (rev 1689)
@@ -2,7 +2,6 @@
//
// DateVector.cpp: Rcpp R/C++ interface class library -- Date vector support
//
-// Copyright (C) 2005 - 2006 Dominick Samperi
// Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
//
// This file is part of Rcpp.
More information about the Rcpp-commits
mailing list