[Rcpp-devel] Not able to convert from Rcpp::NumericVector to Teuchos::ArrayRCP<size_t>

Chaomei Lo chaomeilo at gmail.com
Fri May 23 00:42:11 CEST 2014

Sorry to confuse you, Dirk, I had my previous message title wrong.  Here
below was the message with the correct title and content.

I have created R packages using Makevars and it works pretty good for me.
I am able to convert from a Rcpp::NumericVector to std::vector as in below.

*NumericVector col_cts = buildMatrix(Xr);vector<long unsigned int>
col_counts = Rcpp::as<vector<long unsigned int>>(col_cts);  *
Now I am having a problem with an application involves the Trilinos
library. Here below I am trying to convert a Rcpp::NumericVector to
Teuchos::ArrayRCP<size_t> in the following line, it gave me errors as shown
below in red.  Would you please help me with this ?


Thanks a lot.

In file included from
                 from buildMatrix.cpp:4:
In constructor 'Rcpp::traits::Exporter<T>::Exporter(SEXP) [with T =
RCP<long unsigned int>, SEXP = SEXPREC*]':
instantiated from 'T Rcpp::internal::as(SEXP,
Rcpp::traits::r_type_generic_tag) [with T =
 Teuchos::ArrayRCP<long unsigned int>, SEXP = SEXPREC*]'
instantiated from 'T Rcpp::as(SEXP) [with T = Teuchos::ArrayRCP<long
unsigned int>, SEXP
buildMatrix.cpp:84:87:   instantiated from here
error: invalid conversion from 'SEXP' to 'long int' [-fpermissive]
error:   initializing argument 1 of 'Teuchos::ArrayRCP<T>::ArrayRC
P(Teuchos::ArrayRCP<T>::size_type, const T&) [with T = long unsigned int,
Teuchos::ArrayRCP<T>::size_type = long int]' [-fpermissive]
make: *** [buildMatrix.o] Error 1
ERROR: compilation failed for package 'Tpkg'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140522/153c7ccf/attachment.html>

More information about the Rcpp-devel mailing list