[Rcpp-devel] CharacterVector::iterator
Hello, This did not make the cut for Rcpp 0.7.5 which was released yesterday, but I've started to play around with CharacterVector::iterator. Here is another way to say paste( letters, collapse = "" ) using std::accumulate : funx <- cfunction(signature(x = "character"), ' CharacterVector letters(x) ; std::string res( std::accumulate( letters.begin(), letters.end(), std::string() ) ) ; return wrap(res) ; ; ', Rcpp = TRUE, includes = "using namespace Rcpp;" ) > funx( letters ) [1] "abcdefghijklmnopqrstuvwxyz" Romain
Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/MPYc : RProtoBuf: protocol buffers for R |- http://tr.im/KfKn : Rcpp 0.7.2 `- http://tr.im/JOlc : External pointers with Rcpp