[Rcpp-devel] api/meat/is.h missing CharacterVector and CharacterMatrix

Dirk Eddelbuettel edd at debian.org
Wed Oct 2 05:05:37 CEST 2013


Thomas,

On 2 October 2013 at 10:12, Thomas Tse wrote:
| hi,
| 
| seems like api/meat/is.h missed the implementation for CharacterVector and CharacterMatrix, i.e. we should add:
| 
|     template <> inline bool is__simple<CharacterVector>( SEXP x ){
|         return TYPEOF(x) == STRSXP ;
|     }
|     template <> inline bool is__simple<CharacterMatrix>( SEXP x ){
|         return TYPEOF(x) == STRSXP && is_matrix(x) ;
|     }

Looks like a good catch, and nice work.  If I add this, I can in fact do

R> cppFunction('bool isCharVec(SEXP x) {return(is<CharacterVector>(x));}')
R> isCharVec(LETTERS)
[1] TRUE
R> 

whereas I get a linker error without your suggested change. Unit tests all
pass, so no colleteral damage -- hence committed as rev4553, and added you to
the THANKS file.

Thanks -- keep the fixes coming!  ;-)

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list