Skip to content

Conversation

thirdwing
Copy link
Member

The CRAN version:

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
String replace() {
  String foo("abba");
  return foo.replace_first("ba", "BA");
}

/*
> Rcpp::sourceCpp("test.cpp")
> replace()
[1] "BAba"
*/

After fix:

> Rcpp::sourceCpp("test.cpp")
> replace()
[1] "abBA"

@kevinushey

@eddelbuettel
Copy link
Member

Looks good first glance.

@kevinushey
Copy link
Contributor

Looks good to me as well -- I kind of wish we could get away without copying the C strings into std::strings, but I'm fine with the PR as-is.

@eddelbuettel eddelbuettel merged commit 43f2ee6 into RcppCore:master May 17, 2016
@kevinushey
Copy link
Contributor

Thanks for doing the legwork @thirdwing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants