[Rcpp-commits] r485 - in pkg: inst src src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 27 16:33:16 CET 2010


Author: romain
Date: 2010-01-27 16:33:16 +0100 (Wed, 27 Jan 2010)
New Revision: 485

Modified:
   pkg/inst/ChangeLog
   pkg/src/CharacterVector.cpp
   pkg/src/Rcpp/CharacterVector.h
Log:
implicit conversion from CharacterVector::StringProxy to std::string

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-01-27 14:59:12 UTC (rev 484)
+++ pkg/inst/ChangeLog	2010-01-27 15:33:16 UTC (rev 485)
@@ -1,5 +1,8 @@
 2010-01-27  Romain Francois <francoisromain at free.fr>
 
+	* src/Rcpp/CharacterVector.h: CharacterVector::StringProxy
+	gains implicit conversion to std::string
+
 	* src/Rcpp/Environment.h: removed the static 
 	Environment::RCPP_NAMESPACE which caused problems when 
 	embedding R

Modified: pkg/src/CharacterVector.cpp
===================================================================
--- pkg/src/CharacterVector.cpp	2010-01-27 14:59:12 UTC (rev 484)
+++ pkg/src/CharacterVector.cpp	2010-01-27 15:33:16 UTC (rev 485)
@@ -54,6 +54,10 @@
 	return const_cast<char*>( CHAR(STRING_ELT( parent, index )) );
 }
 
+CharacterVector::StringProxy::operator std::string() const {
+	return std::string( CHAR(STRING_ELT( parent, index )) );
+}
+
 CharacterVector::StringProxy& CharacterVector::StringProxy::operator=( const StringProxy& rhs){
 	SET_STRING_ELT( parent, index, STRING_ELT( rhs.parent, rhs.index) ) ;
 	return *this ;

Modified: pkg/src/Rcpp/CharacterVector.h
===================================================================
--- pkg/src/Rcpp/CharacterVector.h	2010-01-27 14:59:12 UTC (rev 484)
+++ pkg/src/Rcpp/CharacterVector.h	2010-01-27 15:33:16 UTC (rev 485)
@@ -47,6 +47,7 @@
 		/* rvalue use */
 		operator SEXP() const ;
 		operator char*() const ;
+		operator std::string() const ;
 		
 	private:
 		CharacterVector& parent; 



More information about the Rcpp-commits mailing list