[Rcpp-commits] r839 - pkg/Rcpp/src/Rcpp
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Mar 5 19:14:12 CET 2010
Author: romain
Date: 2010-03-05 19:14:12 +0100 (Fri, 05 Mar 2010)
New Revision: 839
Modified:
pkg/Rcpp/src/Rcpp/Vector.h
Log:
string_name_proxy gains begin(), end(), size() and operator[](int)
Modified: pkg/Rcpp/src/Rcpp/Vector.h
===================================================================
--- pkg/Rcpp/src/Rcpp/Vector.h 2010-03-05 16:58:41 UTC (rev 838)
+++ pkg/Rcpp/src/Rcpp/Vector.h 2010-03-05 18:14:12 UTC (rev 839)
@@ -96,6 +96,8 @@
class string_name_proxy{
public:
typedef typename ::Rcpp::Vector<RTYPE> VECTOR ;
+ typedef char* iterator ;
+ typedef char& reference ;
string_name_proxy( VECTOR& v, const std::string& name_) :
parent(v), name(name_){} ;
@@ -120,6 +122,11 @@
return ::Rf_mkString(get()) ;
}
+ inline iterator begin() { return get() ; }
+ inline iterator end(){ return begin() + size() ; }
+ inline reference operator[]( int i ){ return *( get() + i ) ; }
+ inline int size(){ return strlen( get() ) ; }
+
private:
VECTOR& parent ;
std::string name;
More information about the Rcpp-commits
mailing list