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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 7 19:19:14 CET 2010


Author: romain
Date: 2010-01-07 19:19:14 +0100 (Thu, 07 Jan 2010)
New Revision: 307

Modified:
   pkg/src/Rcpp/wrap.h
   pkg/src/wrap.cpp
Log:
some more inlining

Modified: pkg/src/Rcpp/wrap.h
===================================================================
--- pkg/src/Rcpp/wrap.h	2010-01-07 18:06:48 UTC (rev 306)
+++ pkg/src/Rcpp/wrap.h	2010-01-07 18:19:14 UTC (rev 307)
@@ -42,24 +42,26 @@
 
 RObject wrap(SEXP m_sexp) ;
 
-LogicalVector wrap(const bool & v);
+LogicalVector wrap(const bool & v); 
 NumericVector wrap(const double & v);
 IntegerVector wrap(const int & v);
-CharacterVector wrap(const char* const v);
 RawVector wrap(const Rbyte & v);
-CharacterVector wrap(const std::string & v);
 
 IntegerVector wrap(const std::vector<int> & v);
 NumericVector wrap(const std::vector<double> & v);
-CharacterVector wrap(const std::vector<std::string> & v);
 RawVector wrap(const std::vector<Rbyte> & v);
 LogicalVector wrap(const std::vector<bool> & v);
 
 IntegerVector wrap(const std::set<int> & v);
 NumericVector wrap(const std::set<double> & v);
-CharacterVector wrap(const std::set<std::string> & v);
 RawVector wrap(const std::set<Rbyte> & v);
+CharacterVector wrap(const std::set<std::string> & v) ; 
 
+inline CharacterVector wrap(const char* const v){ return CharacterVector(v); }
+inline CharacterVector wrap(const std::string & v){ return CharacterVector(v); }
+inline CharacterVector wrap(const std::vector<std::string> & v){ return CharacterVector(v); }
+
+
 #ifdef HAS_INIT_LISTS
 inline IntegerVector wrap( std::initializer_list<int> list) { return IntegerVector( list ) ;}
 inline NumericVector wrap( std::initializer_list<double> list) { return NumericVector( list ); } 

Modified: pkg/src/wrap.cpp
===================================================================
--- pkg/src/wrap.cpp	2010-01-07 18:06:48 UTC (rev 306)
+++ pkg/src/wrap.cpp	2010-01-07 18:19:14 UTC (rev 307)
@@ -112,16 +112,6 @@
     return o ;
 }
 
-CharacterVector wrap( const char * const v){
-	return wrap( std::string(v) ) ;
-}
-
-CharacterVector wrap(const std::string & v){
-    logTxt("RObject from std::string\n");
-    CharacterVector o(Rf_mkString(v.c_str()));
-    return o ;
-}
-
 LogicalVector wrap(const std::vector<bool> & v){
     logTxt("RObject from bool vector\n");
     int n = v.size();
@@ -162,22 +152,6 @@
     return o ;
 }
 
-CharacterVector wrap(const std::vector<std::string> & v){
-    logTxt("RObject from std::string vector\n");
-    int n = v.size();
-    SEXP m_sexp = PROTECT(Rf_allocVector(STRSXP, n));
-    int i=0; 
-    std::vector<std::string>::const_iterator it = v.begin() ;
-    while( i<n ){
-    	SET_STRING_ELT(m_sexp, i, Rf_mkChar(it->c_str()));
-    	i++ ;
-    	it++; 
-    }
-    CharacterVector o(m_sexp) ;
-    UNPROTECT(1) ;
-    return o ;
-}
-
 /* sets */
 
 IntegerVector wrap(const std::set<int> & v){



More information about the Rcpp-commits mailing list