[Rcpp-commits] r4512 - in pkg/Rcpp: . inst/include/Rcpp
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 18 16:35:49 CEST 2013
Author: romain
Date: 2013-09-18 16:35:49 +0200 (Wed, 18 Sep 2013)
New Revision: 4512
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/TODO
pkg/Rcpp/inst/include/Rcpp/as.h
Log:
as<char> specialization
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2013-09-18 13:12:31 UTC (rev 4511)
+++ pkg/Rcpp/ChangeLog 2013-09-18 14:35:49 UTC (rev 4512)
@@ -2,12 +2,13 @@
* R/Attributes.R: Don't search the inline package as a fallback when loading plugins for the the Rcpp::plugins attribute
-2013-09-16 Romain Francois <romain at r-enthusiasts.com>
+2013-09-18 Romain Francois <romain at r-enthusiasts.com>
* vignettes/Rcpp-package.Rnw: Updating the vignette. Setting attributes to TRUE
by default.
* R/Rcpp.package.skeleton.R: Setting attributes to TRUE by default. This is
what we should encourage people to use.
+ * include/Rcpp/as.h: add as<char> specialization
2013-09-17 JJ Allaire <jj at rstudio.org>
Modified: pkg/Rcpp/TODO
===================================================================
--- pkg/Rcpp/TODO 2013-09-18 13:12:31 UTC (rev 4511)
+++ pkg/Rcpp/TODO 2013-09-18 14:35:49 UTC (rev 4512)
@@ -10,9 +10,6 @@
o DataFrame::create(Named("a")=b, Named("b")=b) fails with
NumericVectors
- o Single char variables do not seem to covered correctly by as<>()
- and wrap() (cf http://stackoverflow.com/questions/16535899/)
-
Documentation
o Finish the quickref vignette
Modified: pkg/Rcpp/inst/include/Rcpp/as.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/as.h 2013-09-18 13:12:31 UTC (rev 4511)
+++ pkg/Rcpp/inst/include/Rcpp/as.h 2013-09-18 14:35:49 UTC (rev 4512)
@@ -145,6 +145,10 @@
return internal::as<T>( m_sexp, typename traits::r_type_traits<T>::r_category() ) ;
}
+ template <> inline char as<char>( SEXP m_sexp ){
+ return internal::check_single_string(m_sexp)[0] ;
+ }
+
template <typename T>
inline typename traits::remove_const_and_reference<T>::type bare_as( SEXP m_sexp ){
return as< typename traits::remove_const_and_reference<T>::type >( m_sexp ) ;
More information about the Rcpp-commits
mailing list