[Rcpp-commits] r4149 - in pkg/Rcpp: . inst/include/Rcpp/vector

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 11 16:21:06 CET 2012


Author: romain
Date: 2012-12-11 16:21:06 +0100 (Tue, 11 Dec 2012)
New Revision: 4149

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
Log:
const version of Vector::operator[](string)

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2012-12-11 15:04:05 UTC (rev 4148)
+++ pkg/Rcpp/ChangeLog	2012-12-11 15:21:06 UTC (rev 4149)
@@ -10,6 +10,7 @@
         implementing paste( . , collapse = "" )
         * include/Rcpp/complex.h: operator==( Rcomplex, Rcomplex )
         * src/api.cpp: implementation of operator==(Rcomplex, Rcomplex)
+        * include/Rcpp/vector/Vector.h: added const version of operator[](string)
 
 2012-12-10  JJ Allaire <jj at rstudio.org>
 

Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2012-12-11 15:04:05 UTC (rev 4148)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2012-12-11 15:21:06 UTC (rev 4149)
@@ -273,6 +273,13 @@
         return NameProxy( *this, name ) ;
     }
 	
+    inline NameProxy operator[]( const std::string& name ) const {
+        return NameProxy( const_cast<Vector&>(*this), name ) ;
+    }
+    inline NameProxy operator()( const std::string& name ) const {
+        return NameProxy( const_cast<Vector&>(*this), name ) ;
+    }
+	
     Vector& sort(){
         std::sort( 
             internal::r_vector_start<RTYPE>(m_sexp), 



More information about the Rcpp-commits mailing list