[Rcpp-commits] r3435 - pkg/RcppExamples/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 29 02:42:52 CET 2011


Author: edd
Date: 2011-12-29 02:42:51 +0100 (Thu, 29 Dec 2011)
New Revision: 3435

Modified:
   pkg/RcppExamples/src/classicRcppDateExample.cpp
   pkg/RcppExamples/src/newRcppDateExample.cpp
Log:
switch from std::cout (which is discouraged) to the new Rcpp::Rcout


Modified: pkg/RcppExamples/src/classicRcppDateExample.cpp
===================================================================
--- pkg/RcppExamples/src/classicRcppDateExample.cpp	2011-12-25 20:14:33 UTC (rev 3434)
+++ pkg/RcppExamples/src/classicRcppDateExample.cpp	2011-12-29 01:42:51 UTC (rev 3435)
@@ -4,7 +4,7 @@
 //
 // Copyright (C) 2005 - 2006 Dominick Samperi
 // Copyright (C) 2008        Dirk Eddelbuettel
-// Copyright (C) 2009 - 2010 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2009 - 2011 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -35,12 +35,12 @@
 	
 	Rprintf("\nIn C++, seeing the following date value\n");
 	for (int i=0; i<dv.size(); i++) {
-	    std::cout << dv(i) << std::endl;
+	    Rcpp::Rcout << dv(i) << std::endl;
 	    dv(i) = dv(i) + 7;		// shift a week
 	}
 	Rprintf("\nIn C++, seeing the following datetime value\n");
 	for (int i=0; i<dtv.size(); i++) {
-	    std::cout << dtv(i) << std::endl;
+	    Rcpp::Rcout << dtv(i) << std::endl;
 	    dtv(i) = dtv(i) + 0.250;    // shift 250 millisec
 	}
 

Modified: pkg/RcppExamples/src/newRcppDateExample.cpp
===================================================================
--- pkg/RcppExamples/src/newRcppDateExample.cpp	2011-12-25 20:14:33 UTC (rev 3434)
+++ pkg/RcppExamples/src/newRcppDateExample.cpp	2011-12-29 01:42:51 UTC (rev 3435)
@@ -2,7 +2,7 @@
 //
 // RcppParamsExample.h: Rcpp R/C++ interface class library RcppDate example
 //
-// Copyright (C) 2009 - 2010 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2009 - 2011 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -32,12 +32,12 @@
 
 	Rprintf("\nIn C++, seeing the following date value\n");
 	for (int i=0; i<dv.size(); i++) {
-	    std::cout << Rcpp::as<std::string>(formatDate(Rcpp::wrap(dv[i]))) << std::endl;
+	    Rcpp::Rcout << Rcpp::as<std::string>(formatDate(Rcpp::wrap(dv[i]))) << std::endl;
 	    dv[i] = dv[i] + 7;		// shift a week
 	}
 	Rprintf("\nIn C++, seeing the following datetime value\n");
 	for (int i=0; i<dtv.size(); i++) {
-	    std::cout << Rcpp::as<std::string>(formatDatetime(Rcpp::wrap(dtv[i]))) << std::endl;
+	    Rcpp::Rcout << Rcpp::as<std::string>(formatDatetime(Rcpp::wrap(dtv[i]))) << std::endl;
 	    dtv[i] = dtv[i] + 0.250;    // shift 250 millisec
 	}
 



More information about the Rcpp-commits mailing list