<div dir="ltr"><div>Sorry to confuse you, Dirk, I had my previous message title wrong.  Here below was the message with the correct title and content.</div><div> </div><div>////////////////////////////////</div><div><div>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. </div>
<div> </div><div><div><em>NumericVector col_cts = buildMatrix(Xr);<br><br>vector<long unsigned int> col_counts = Rcpp::as<vector<long unsigned int>>(col_cts);<br>  </em><br>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 ?</div>
<div> </div><div><em>Teuchos::ArrayRCP<size_t> col_counts=Rcpp::as<Teuchos::ArrayRCP<size_t>>(col_cts);</em></div><div> </div><div>Thanks a lot.</div><div> </div></div><div><font style="background-color:rgb(255,255,255)"><font color="#ff0000"><font>In file included from /share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp/as.h:25:0,<br>
  </font>                </font></font><font color="#ff0000" style="background-color:rgb(255,255,255)">from /share/apps/R/3.0.2/lib64/R/library/Rcpp/include/RcppCommon.h:169,<br>                 from /share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp.h:27,<br>
                  from buildMatrix.cpp:4:<br>/share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp/internal/Exporter.h: In constructor 'Rcpp::traits::Exporter<T>::Exporter(SEXP) [with T = Teuchos::Array<br>RCP<long unsigned int>, SEXP = SEXPREC*]':<br>
 /share/apps/R/3.0.2/lib64/R/library/Rcpp/<font>include</font>/Rcpp/as.h:79:51:   instantiated from 'T Rcpp::internal::as(SEXP, Rcpp::traits::r_type_generic_tag) [with T =<br> Teuchos::ArrayRCP<long unsigned int>, SEXP = SEXPREC*]'<br>
 /share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp/as.h:144:84:   instantiated from 'T Rcpp::as(SEXP) [with T = Teuchos::ArrayRCP<long unsigned int>, SEXP<br> = SEXPREC*]'<br>buildMatrix.cpp:84:87:   <font>instantiated</font> from here<br>
 /share/apps/R/3.0.2/lib64/R/library/Rcpp/include/Rcpp/internal/Exporter.h:31:31: error: invalid conversion from 'SEXP' to 'long int' [-fpermissive]<br>/people/d3j508/trilinos-11.6.1/trilinos-11.6.1_Install/include/Teuchos_ArrayRCP.hpp:129:1: error:   initializing argument 1 of 'Teuchos::ArrayRCP<T>::ArrayRC<br>
 P(Teuchos::ArrayRCP<T>::size_type, const T&) [with T = long unsigned int, Teuchos::ArrayRCP<T>::size_type = long int]' [-fpermissive]<br>make: *** [buildMatrix.o] Error 1<br>ERROR: compilation failed for package 'Tpkg'</font></div>
<div></div></div></div>