Ha. That's simultaneously kinda funny and kinda painful. It was embedded
into an Rmd Rcpp chunk and I forgot the C++ entry point... sigh.

THK

http://www.keittlab.org/

On Thu, Mar 8, 2018 at 12:20 PM, Dirk Eddelbuettel <e...@debian.org> wrote:

>
> Tim,
>
> Three distinct errors:
>
> - no wrapping function, so sourceCpp() was the wrong paradigm
> - no inclusion of Rcpp.h so types unknown (agem)
> - wrong calling convention for runif(), cannot be empty.
>
> The following compiles, it may still be nonsensical.
>
> Dirk
>
>
> // [[Rcpp::depends(BH)]]
> // [[Rcpp::plugins(cpp11)]]
>
> #include <Rcpp.h>
>
> #include <vector>
> #include <boost/geometry.hpp>
> #include <boost/geometry/geometries/point_xy.hpp>
>
> using key_type = boost::geometry::model::d2::point_xy<double>;
> using range_type = std::vector<key_type>;
>
> // [[Rcpp::export]]
> void foo() {
>   range_type data;
>   data.reserve(1e6);
>
>   for (int i = 0; i != 1e6; ++i)
>     data.emplace_back(R::runif(0,1), R::runif(0,1));
> }
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to