[Rcpp-commits] r732 - in pkg/Rcpp/src: . Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 18 08:50:27 CET 2010


Author: romain
Date: 2010-02-18 08:50:27 +0100 (Thu, 18 Feb 2010)
New Revision: 732

Modified:
   pkg/Rcpp/src/Rcpp/SEXP_Vector.h
   pkg/Rcpp/src/SEXP_Vector.cpp
Log:
move the indexing operator down so that name based and offset based are at the same place

Modified: pkg/Rcpp/src/Rcpp/SEXP_Vector.h
===================================================================
--- pkg/Rcpp/src/Rcpp/SEXP_Vector.h	2010-02-17 21:22:16 UTC (rev 731)
+++ pkg/Rcpp/src/Rcpp/SEXP_Vector.h	2010-02-18 07:50:27 UTC (rev 732)
@@ -107,19 +107,6 @@
 	
 	SEXP_Vector_Base() ; 
 	
-	inline const Proxy operator[]( int i ) const throw(index_out_of_bounds){
-		return Proxy(const_cast<SEXP_Vector_Base&>(*this), offset(i)) ;
-	}
-	inline Proxy operator[]( int i ) throw(index_out_of_bounds){
-		return Proxy(*this, offset(i) ) ; 
-	}
-	
-	inline iterator begin() { return iterator(*this, 0) ; }
-	inline iterator end() { return iterator(*this, size() ) ; }
-	
-	Proxy operator()( const size_t& i) throw(index_out_of_bounds) ; 
-	Proxy operator()( const size_t& i, const size_t& j) throw(index_out_of_bounds,not_a_matrix) ;
-	
 	friend class Proxy;
 	friend class iterator ;
 	
@@ -217,6 +204,23 @@
 		return NameProxy( const_cast<SEXP_Vector&>(*this), name ) ;
 	}
     	
+	inline const Proxy operator[]( int i ) const throw(index_out_of_bounds){
+		return Proxy(const_cast<SEXP_Vector_Base&>(*this), offset(i)) ;
+	}
+	inline Proxy operator[]( int i ) throw(index_out_of_bounds){
+		return Proxy(*this, offset(i) ) ; 
+	}
+	
+	inline iterator begin() { return iterator(*this, 0) ; }
+	inline iterator end() { return iterator(*this, size() ) ; }
+	
+	Proxy operator()( const size_t& i) throw(index_out_of_bounds) {
+		return Proxy(*this, offset(i) ) ;
+	}
+	Proxy operator()( const size_t& i, const size_t& j) throw(index_out_of_bounds,not_a_matrix){
+		return Proxy(*this, offset(i,j) ) ;
+	}
+	
 	template <typename InputIterator>
 	void assign( InputIterator first, InputIterator last){
 		/* FIXME: we might not need the wrap if the object already 

Modified: pkg/Rcpp/src/SEXP_Vector.cpp
===================================================================
--- pkg/Rcpp/src/SEXP_Vector.cpp	2010-02-17 21:22:16 UTC (rev 731)
+++ pkg/Rcpp/src/SEXP_Vector.cpp	2010-02-18 07:50:27 UTC (rev 732)
@@ -65,13 +65,6 @@
 /* SEXP_Vector_Base */
 SEXP_Vector_Base::SEXP_Vector_Base() : VectorBase(){}
 
-SEXP_Vector_Base::Proxy SEXP_Vector_Base::operator()( const size_t& i) throw(index_out_of_bounds) {
-	return Proxy(*this, offset(i) ) ;
-}
-SEXP_Vector_Base::Proxy SEXP_Vector_Base::operator()( const size_t& i, const size_t& j) throw(index_out_of_bounds,not_a_matrix){
-	return Proxy(*this, offset(i,j) ) ;
-}
-
 } // namespace Rcpp
 
 namespace std{



More information about the Rcpp-commits mailing list