[Rcpp-commits] r368 - in pkg: inst src src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 13 08:50:10 CET 2010


Author: romain
Date: 2010-01-13 08:50:10 +0100 (Wed, 13 Jan 2010)
New Revision: 368

Modified:
   pkg/inst/ChangeLog
   pkg/src/IntegerVector.cpp
   pkg/src/LogicalVector.cpp
   pkg/src/NumericVector.cpp
   pkg/src/RawVector.cpp
   pkg/src/Rcpp/IntegerVector.h
   pkg/src/Rcpp/LogicalVector.h
   pkg/src/Rcpp/NumericVector.h
   pkg/src/Rcpp/RawVector.h
Log:
more inlining

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-01-13 07:42:18 UTC (rev 367)
+++ pkg/inst/ChangeLog	2010-01-13 07:50:10 UTC (rev 368)
@@ -6,10 +6,12 @@
 	Environment env("package:stats") ;
 	Function f = env["rnorm"] ;
 
-	* src/Rcpp/NumericVector.h: operator[] is promoted to inline
+	* src/Rcpp/NumericVector.h: operator[], begiun and end are
+	promoted to inline member functions
+	* src/Rcpp/IntegerVector.h: idem
+	* src/Rcpp/RawVector.h: idem
+	* src/Rcpp/LogicalVector.h: idem
 
-	
-
 2010-01-12  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION: Release 0.7.2

Modified: pkg/src/IntegerVector.cpp
===================================================================
--- pkg/src/IntegerVector.cpp	2010-01-13 07:42:18 UTC (rev 367)
+++ pkg/src/IntegerVector.cpp	2010-01-13 07:50:10 UTC (rev 368)
@@ -60,15 +60,4 @@
 	}
 #endif
 
-int& IntegerVector::operator[]( int i ) const throw(index_out_of_bounds) { 
-	if( i < 0 || i >= length() ) throw index_out_of_bounds() ;
-	return INTEGER(m_sexp)[i] ;
-}
-int* IntegerVector::begin() const { 
-	return INTEGER(m_sexp) ;
-}
-int* IntegerVector::end() const { 
-	return INTEGER(m_sexp) + LENGTH(m_sexp);
-}
-
 } // namespace 

Modified: pkg/src/LogicalVector.cpp
===================================================================
--- pkg/src/LogicalVector.cpp	2010-01-13 07:42:18 UTC (rev 367)
+++ pkg/src/LogicalVector.cpp	2010-01-13 07:50:10 UTC (rev 368)
@@ -66,15 +66,4 @@
 	}
 #endif
 
-int& LogicalVector::operator[]( int i ) const throw(index_out_of_bounds){ 
-	if( i<0 || i>=length()) throw index_out_of_bounds() ;
-	return LOGICAL(m_sexp)[i] ;
-}
-int* LogicalVector::begin() const { 
-	return LOGICAL(m_sexp) ;
-}
-int* LogicalVector::end() const { 
-	return LOGICAL(m_sexp) + LENGTH(m_sexp);
-}
-
 } // namespace 

Modified: pkg/src/NumericVector.cpp
===================================================================
--- pkg/src/NumericVector.cpp	2010-01-13 07:42:18 UTC (rev 367)
+++ pkg/src/NumericVector.cpp	2010-01-13 07:50:10 UTC (rev 368)
@@ -59,11 +59,4 @@
 	}
 #endif
 
-double* NumericVector::begin() const { 
-	return REAL(m_sexp) ;
-}
-double* NumericVector::end() const { 
-	return REAL(m_sexp) + LENGTH(m_sexp);
-}
-
 } // namespace 

Modified: pkg/src/RawVector.cpp
===================================================================
--- pkg/src/RawVector.cpp	2010-01-13 07:42:18 UTC (rev 367)
+++ pkg/src/RawVector.cpp	2010-01-13 07:50:10 UTC (rev 368)
@@ -62,15 +62,4 @@
 	}
 #endif
 
-Rbyte& RawVector::operator[]( int i ) const throw(index_out_of_bounds){ 
-	if( i<0 || i>= length() ) throw index_out_of_bounds() ;
-	return RAW(m_sexp)[i] ;
-}
-Rbyte* RawVector::begin() const { 
-	return RAW(m_sexp) ;
-}
-Rbyte* RawVector::end() const { 
-	return RAW(m_sexp) + LENGTH(m_sexp);
-}
-
 } // namespace 

Modified: pkg/src/Rcpp/IntegerVector.h
===================================================================
--- pkg/src/Rcpp/IntegerVector.h	2010-01-13 07:42:18 UTC (rev 367)
+++ pkg/src/Rcpp/IntegerVector.h	2010-01-13 07:50:10 UTC (rev 368)
@@ -53,9 +53,9 @@
 	 */
 	inline int size() const { return Rf_length( m_sexp ) ; }
 	
-	int& operator[]( int i ) const throw(index_out_of_bounds) ;
-	int* begin() const ; 
-	int* end() const ;
+	inline int& operator[]( int i ) const{ return INTEGER(m_sexp)[i] } ;
+	inline int* begin() const { return INTEGER(m_sexp) ; }
+	inline int* end() const { return INTEGER(m_sexp) + LENGTH(m_sexp) ; }
 	
 	typedef int* iterator ;
 	

Modified: pkg/src/Rcpp/LogicalVector.h
===================================================================
--- pkg/src/Rcpp/LogicalVector.h	2010-01-13 07:42:18 UTC (rev 367)
+++ pkg/src/Rcpp/LogicalVector.h	2010-01-13 07:50:10 UTC (rev 368)
@@ -54,12 +54,11 @@
 	 */
 	inline int size() const { return Rf_length( m_sexp ) ; }
 	
-	typedef Rboolean* iterator ;
-	typedef Rboolean value_type ;
+	typedef int* iterator ;
 	
-	int& operator[]( int i ) const throw(index_out_of_bounds) ;
-	int* begin() const ; 
-	int* end() const ;
+	inline int& operator[]( int i ) const { return LOGICAL(m_sexp)[i] ;}
+	inline int* begin() const { return LOGICAL(m_sexp) ; }
+	inline int* end() const { return LOGICAL(m_sexp) + LENGTH(m_sexp); }
 	
 } ;
 

Modified: pkg/src/Rcpp/NumericVector.h
===================================================================
--- pkg/src/Rcpp/NumericVector.h	2010-01-13 07:42:18 UTC (rev 367)
+++ pkg/src/Rcpp/NumericVector.h	2010-01-13 07:50:10 UTC (rev 368)
@@ -56,8 +56,8 @@
 	inline double& operator[]( const int& i ) { return REAL(m_sexp)[i]; }
 	inline const double& operator[]( const int& i ) const { return REAL(m_sexp)[i]; }
 	
-	double* begin() const ; 
-	double* end() const ;
+	inline double* begin() const { return REAL(m_sexp) ; } 
+	inline double* end() const   { return REAL(m_sexp)+LENGTH(m_sexp);}
 	
 	typedef double* iterator ;
 	

Modified: pkg/src/Rcpp/RawVector.h
===================================================================
--- pkg/src/Rcpp/RawVector.h	2010-01-13 07:42:18 UTC (rev 367)
+++ pkg/src/Rcpp/RawVector.h	2010-01-13 07:50:10 UTC (rev 368)
@@ -53,9 +53,9 @@
 	 */
 	inline int size() const { return Rf_length( m_sexp ) ; }
 	
-	Rbyte& operator[]( int i ) const throw(index_out_of_bounds) ;
-	Rbyte* begin() const ; 
-	Rbyte* end() const ;
+	inline Rbyte& operator[]( int i ) const { return RAW(m_sexp)[i] ; }
+	inline Rbyte* begin() const { return RAW(m_sexp) ; }
+	inline Rbyte* end() const { return RAW(m_sexp) + LENGTH(m_sexp) ; }
 	
 	typedef Rbyte* iterator ;
 	



More information about the Rcpp-commits mailing list