[Rcpp-devel] Boolean vector from R to C++
Cedric Ginestet
c.ginestet05 at googlemail.com
Thu Apr 14 17:00:52 CEST 2011
Hi all,
I am trying to pass on a boolean vector from R to C++. I have naively
tried the following:
################################
src <- '
using namespace Rcpp ;
using namespace std ;
int b = as<bool>(xb);
return wrap(b);'
cxxfun <- cxxfunction(sig=signature(xb="logical"),
body=src,plugin="Rcpp",verbose=TRUE)
cxxfun(b);
Error in cxxfun(b) : expecting a single value
###############################
Is there an equivalent to IntegerVector or NumericVector for Boolean
variables or can I simply use the Rcpp::Vector template for this purpose?
Thanks for your help,
--
Cedric Ginestet
Centre for Neuroimaging Sciences (L3.04)
NIHR Biomedical Research Centre
Department of Neuroimaging
Institute of Psychiatry, Box P089
King's College London
De Crespigny Park
London
SE5 8AF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110414/1a388ffa/attachment.htm>
More information about the Rcpp-devel
mailing list