@@ -51,6 +51,7 @@ namespace Rcpp {
5151 class String {
5252 public:
5353 typedef internal::string_proxy<STRSXP> StringProxy;
54+ typedef internal::const_string_proxy<STRSXP> const_StringProxy;
5455
5556 /* * default constructor */
5657 String ( ): data( Rf_mkChar(" " ) ), buffer(), valid(true ), buffer_ready(true ) {
@@ -71,6 +72,10 @@ namespace Rcpp {
7172 String ( const StringProxy& proxy ): data( proxy.get() ), valid(true ), buffer_ready(false ){
7273 RCPP_STRING_DEBUG ( " String( const StringProxy&)" ) ;
7374 }
75+ /* * from string proxy */
76+ String ( const const_StringProxy& proxy ): data( proxy.get() ), valid(true ), buffer_ready(false ){
77+ RCPP_STRING_DEBUG ( " String( const const_StringProxy&)" ) ;
78+ }
7479
7580 /* * from a std::string */
7681 String ( const std::string& s) : buffer(s), valid(false ), buffer_ready(true ) {
@@ -250,6 +255,12 @@ namespace Rcpp {
250255 valid = false ;
251256 return *this ;
252257 }
258+
259+ template <typename LHS, typename RHS>
260+ inline String& replace_all ( const LHS& s, const RHS& news ){
261+ return replace_all ( String ( s ), String (news) ) ;
262+ }
263+
253264 inline String& replace_all ( const Rcpp::String& s, const char * news ){
254265 // replace NA -> do nothing
255266 if ( s.is_na () ) return *this ;
0 commit comments