[Rcpp-devel] Passing template class as argument in Rcpp function

Iñaki Ucar iucar at fedoraproject.org
Thu Mar 4 20:58:42 CET 2021


On Thu, 4 Mar 2021 at 20:31, Subhomoy Ghosh <subhomoy25 at gmail.com> wrote:
>
> Thanks, for the solution. I tried what you suggested and it shows "no matching constructor for initialization of 'Rcpp::XPtr<Distribution>'". Below here is my attempt:
>
> class Distribution {
>
> public:
>   template <typename T>
>   class Uniform2 {

This is a nested class, which makes little sense in this context.
Uniform2 should *inherit* from Distribution. Again, see my package as
an example, which does exactly what you want.

-- 
Iñaki Úcar


More information about the Rcpp-devel mailing list