[Rcpp-devel] Rostream.h header
edd at debian.org
Sun May 13 16:18:31 CEST 2012
On 12 May 2012 at 19:03, Alexey Stukalov wrote:
| Dear Rcpp developers,
| ATM to define the Rcpp::Rostream I have to fix the iostream/Rostream.h header
| directly and add
| #include "Rstreambuf.h"
| before its declarations.
| Including "Rstreambuf.h" in my source file before "Rstreambuf.h" doesn't help,
| it seems the headers are processed in a way that Rostream declaration comes
| before Rstreambuf
| (due to RcppCommon.h that is included by Rstreambuf.h and not by Rostream.h).
| Is it possible to fix Rostream.h in the mainline or there's another proper way
| to include it?
Can you restate your problem a little differently? I don't quite understand
what you are trying to do, and what is not working.
What do you mean by "define the Rcpp::Rostream" ? You would not have to
include that explicitly as our header structure already does it. See the
example blog post from a few months ago:
That works the same way with Rcpp alone:
R> fun <- cxxfunction(signature(), plugin="Rcpp", body='
+ Rcpp::Rcout << "Hello, world" << std::endl;
R> cat("Before Rcpp-created function\n")
Before Rcpp-created function
R> cat("After Rcpp-created function\n")
After Rcpp-created function
That doesn't work so impressively with inline etc as we come back to the
prompt anyway, but by using Rcpp::Rcout all your stdout access from C++ is
passed through the output stream controlled by R thanks to the work Jelmer did.
Or did I misunderstand and you wanted to do something different ?
R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com
More information about the Rcpp-devel