[Rcpp-commits] r2790 - pkg/Rcpp/inst/include/Rcpp/vector

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 13 18:46:32 CET 2010


Author: romain
Date: 2010-12-13 18:46:32 +0100 (Mon, 13 Dec 2010)
New Revision: 2790

Modified:
   pkg/Rcpp/inst/include/Rcpp/vector/proxy.h
Log:
same problem with NameProxy

Modified: pkg/Rcpp/inst/include/Rcpp/vector/proxy.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/proxy.h	2010-12-13 17:34:38 UTC (rev 2789)
+++ pkg/Rcpp/inst/include/Rcpp/vector/proxy.h	2010-12-13 17:46:32 UTC (rev 2790)
@@ -158,12 +158,12 @@
 		
 		// TODO: other operators +=, -=, ...
 		
-		operator SEXP(){
+		operator SEXP() const {
 			 return get() ;
 		}
 		
 		template <typename T>
-		operator T(){
+		operator T() const {
 			#if RCPP_DEBUG_LEVEL > 0
 			SEXP res = get() ;
 			RCPP_DEBUG_1( "generic_name_proxy::get() = <%p> ", res ) ;
@@ -173,6 +173,10 @@
 			#endif
 		}
 		
+		operator bool() const{
+		    return ::Rcpp::as<bool>(get()); 
+		}
+		
 	private:
 		VECTOR& parent ;
 		std::string name;
@@ -185,7 +189,7 @@
 				parent.push_back( rhs, name ); 
 			}
 		}
-		SEXP get(){
+		SEXP get() const {
 			return parent[ parent.offset(name) ];
 		}
 	} ;



More information about the Rcpp-commits mailing list