Yes, escaping from the check seems difficult. I have created a quick PR on this for further discussion.
Watal On Sat, Oct 27, 2018 at 2:13 AM Dirk Eddelbuettel <e...@debian.org> wrote: > > Hi Watal, > > Thanks for being patient with me :) > > On 27 October 2018 at 01:26, Watal M. Iwasaki wrote: > | Sorry for my poor explanation. I have read > | `inst/include/Rcpp/iostream/Rstreambuf.h` and think I understand the role > | of Rcpp::Rcout, but failed to explain my point. By "users [...] can just > | stick to std::cout", I did not mean allowing users to write to stdout via > | std::cout. It is about changing the destination of std::cout from stdout > to > | R's i/o. The following code hopefully explains better: > | > | ``` > | // [[Rcpp::export]] > | void example_function() { > | // Normal state > | std::cout << "to stdout; BAD\n"; > | Rcpp::Rcout << "to R's i/o\n"; > | > | // Ideal state > | std::streambuf* stdoutbuf = std::cout.rdbuf(Rcpp::Rcout.rdbuf()); > | std::cout << "to R's i/o via Rcpp::Rcout.buf; GOOD\n" > | Rcpp::Rcout << "to R's i/o\n"; > | > | // Restore original state > | std::cout.rdbuf(stdoutbuf); > | std::cout << "to stdout; BAD\n"; > | Rcpp::Rcout << "to R's i/o\n"; > | } > | ``` > | > | In other words, we don't have to replace std::cout with Rcpp::Rcout. We > | only have to change its buffer. > > I like it! I think that may fix it. > > It may not fix the detection by R CMD check, but if we can show that we do > the right thing maybe this can be adjusted (to also account for Rcpp and > whatever (hidden) macro we may use to provide this. > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org > -- Watal M. Iwasaki / 岩嵜 航 SOKENDAI, The Graduate University for Advanced Studies, Hayama, Kanagawa 240-0193, Japan +81-46-858-1576 https://heavywatal.github.io/
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel