[Rcpp-commits] r845 - pkg/Rcpp/src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 7 13:27:14 CET 2010


Author: romain
Date: 2010-03-07 13:27:13 +0100 (Sun, 07 Mar 2010)
New Revision: 845

Modified:
   pkg/Rcpp/src/Rcpp/Vector.h
Log:
added string_proxy::apply

Modified: pkg/Rcpp/src/Rcpp/Vector.h
===================================================================
--- pkg/Rcpp/src/Rcpp/Vector.h	2010-03-07 11:45:01 UTC (rev 844)
+++ pkg/Rcpp/src/Rcpp/Vector.h	2010-03-07 12:27:13 UTC (rev 845)
@@ -1284,6 +1284,16 @@
 			set( buffer ) ;
 		}
 		
+		template <typename OutputIterator, typename UnaryOperator>
+		void apply( OutputIterator target, UnaryOperator op){
+			std::transform( begin(), end(), target, op ) ;
+		}
+		
+		template <typename UnaryOperator>
+		void apply( UnaryOperator op){
+			std::for_each( begin(), end(), op );
+		}
+		
 		private:
 			static std::string buffer ;
 		



More information about the Rcpp-commits mailing list