[Rcpp-devel] Problem exposing constructor taking std::vector of user defined class to R using Rcpp-attributes and Rcpp-modules

Luke.Domanski at csiro.au Luke.Domanski at csiro.au
Thu Aug 22 03:02:17 CEST 2013



> 
> namespace Rcpp {
> 	template <> B as( SEXP ){
> 		Rcpp::Reference in_b(b);
> 		id=in_b.field("id");
> 	}
> }
> 

This should be:

namespace Rcpp {
	template <> B as( SEXP );
}

#include <Rcpp.h>

template <> B Rcpp::as( SEXP b ){
    Rcpp::Reference in_b(b);
    return B(wrap<int>(in_b.field("id")));
}

Which I have tried, but I still get the same error. Will follow up on Dirk's other suggestions.



More information about the Rcpp-devel mailing list