[Rcpp-commits] r1685 - in pkg/Rcpp: inst/include/Rcpp src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 23 20:49:25 CEST 2010


Author: edd
Date: 2010-06-23 20:49:25 +0200 (Wed, 23 Jun 2010)
New Revision: 1685

Modified:
   pkg/Rcpp/inst/include/Rcpp/DateVector.h
   pkg/Rcpp/src/DateVector.cpp
Log:
add operator[] as well


Modified: pkg/Rcpp/inst/include/Rcpp/DateVector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/DateVector.h	2010-06-23 18:19:21 UTC (rev 1684)
+++ pkg/Rcpp/inst/include/Rcpp/DateVector.h	2010-06-23 18:49:25 UTC (rev 1685)
@@ -34,6 +34,8 @@
 		~DateVector() {};
 		const Date& operator()(unsigned int i) const;
 		Date& operator()(unsigned int i);
+		const Date& operator[](unsigned int i) const;
+		Date& operator[](unsigned int i);
 		int size() const;
 		std::vector<Date> getDates() const;
 	private:

Modified: pkg/Rcpp/src/DateVector.cpp
===================================================================
--- pkg/Rcpp/src/DateVector.cpp	2010-06-23 18:19:21 UTC (rev 1684)
+++ pkg/Rcpp/src/DateVector.cpp	2010-06-23 18:49:25 UTC (rev 1685)
@@ -60,6 +60,14 @@
 		return v[i];
 	}
 
+	const Date & DateVector::operator[](unsigned int i) const {
+		return v[i];
+	}
+
+	Date & DateVector::operator[](unsigned int i) {
+		return v[i];
+	}
+
 	int DateVector::size() const { 
 		return v.size(); 
 	}



More information about the Rcpp-commits mailing list