[Rcpp-commits] r841 - pkg/Rcpp/src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 7 10:52:51 CET 2010


Author: romain
Date: 2010-03-07 10:52:50 +0100 (Sun, 07 Mar 2010)
New Revision: 841

Modified:
   pkg/Rcpp/src/Rcpp/Vector.h
Log:
need a const cast

Modified: pkg/Rcpp/src/Rcpp/Vector.h
===================================================================
--- pkg/Rcpp/src/Rcpp/Vector.h	2010-03-06 02:07:21 UTC (rev 840)
+++ pkg/Rcpp/src/Rcpp/Vector.h	2010-03-07 09:52:50 UTC (rev 841)
@@ -1269,11 +1269,14 @@
 			SET_STRING_ELT( *parent, index, x ) ;
 		}
 		
-		inline iterator begin(){ return CHAR( STRING_ELT( *parent, index ) ) ; }
+		inline iterator begin(){ return const_cast<char*>( CHAR( STRING_ELT( *parent, index ) ) ) ; }
 		inline iterator end(){ return begin() + size() ; }
-		inline int size(){ return strlen( begin() ) ; }
+		inline int size(){ return strlen( const_begin() ) ; }
 		inline reference operator[]( int n ){ return *( begin() + n ) ; }
 		
+		
+		private:
+		inline const char* const_begin(){ return CHAR( STRING_ELT( *parent, index ) ) ; }
 	} ;
 	
 	inline std::ostream& operator<<(std::ostream& os, const string_proxy<STRSXP>& proxy) {



More information about the Rcpp-commits mailing list