[Rcpp-devel] RCPP_EXPORT_CLASS(std::vector<T>)
romain at r-enthusiasts.com
romain at r-enthusiasts.com
Wed Mar 6 08:02:52 CET 2013
Thanks. I'll have a look.
Romain
Le mer 6/03/13 00:45 , Greg Minshall a écrit::
hi. this is just me reporting on a learning exercise, in case it might
be of help to someone else. the summary is that one might need to
expose the types of member classes (in particular, *vector* types) of
classes that are being exported with the RCPP_EXPOSED_CLASS directive.
in compiling the following program, it did *not* compile (error messages
below) when the "XXX KEY LINE" was *not* included. but, including that
line allows the code to compile.
----
#include
#include
#include
class cluster {
public:
int cells;
};
class cluslist {
public:
std::vector list;
};
#include
RCPP_EXPOSED_CLASS(cluster)
RCPP_EXPOSED_CLASS_NODECL(std::vector) // XXX KEY LINE!!!
RCPP_EXPOSED_CLASS(cluslist)
using namespace Rcpp;
RCPP_MODULE(cluster_module) {
class_("cluster")
.constructor()
.field_readonly("cells", &cluster::cells);
class_("cluslist")
.field("list", &cluslist::list);
};
----
i had thought that, knowing how to wrap, Rcpp::Module would be
able to wrap>, but it can't. with *non-module*
wraps, Rcpp *does* know how to wrap> (but cannot
as> -- since, i believe, the call graph of template
function calls cannot contain a cycle).
error messages (really meant for google searches):
----
.../include/Rcpp/internal/wrap.h: In function 'SEXPREC* Rcpp::internal::range_wrap_dispatch(InputIterator, InputIterator) [with InputIterator = __gnu_cxx::__normal_iterator > >, T = cluster]':
.../include/Rcpp/internal/wrap.h:335: instantiated from 'SEXPREC* Rcpp::internal::range_wrap(InputIterator, InputIterator) [with InputIterator = __gnu_cxx::__normal_iterator > >]'
.../include/Rcpp/internal/wrap.h:451: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_unknown_iterable__logical(const T&, Rcpp::traits::false_type) [with T = std::vector >]'
.../include/Rcpp/internal/wrap.h:458: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_unknown_iterable__matrix_interface(const T&, Rcpp::traits::false_type) [with T = std::vector >]'
.../include/Rcpp/internal/wrap.h:562: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_unknown_iterable(const T&, Rcpp::traits::true_type) [with T = std::vector >]'
.../include/Rcpp/internal/wrap.h:639: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_unknown(const T&, Rcpp::traits::false_type) [with T = std::vector >]'
.../include/Rcpp/internal/wrap.h:670: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_eigen(const T&, Rcpp::traits::false_type) [with T = std::vector >]'
.../include/Rcpp/internal/wrap.h:685: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_unknown_importable(const T&, Rcpp::traits::false_type) [with T = std::vector >]'
.../include/Rcpp/internal/wrap.h:703: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch(const T&, Rcpp::traits::wrap_type_unknown_tag) [with T = std::vector >]'
.../include/Rcpp/internal/wrap.h:807: instantiated from 'SEXPREC* Rcpp::wrap(const T&) [with T = cluster_v]'
../cluster.h:371: instantiated from here
.../include/Rcpp/internal/wrap.h:325: error: no matching function for call to 'range_wrap_dispatch___impl(__gnu_cxx::__normal_iterator > >&, __gnu_cxx::__normal_iterator > >&, Rcpp::traits::r_type_module_object_tag)'
----
cheers, Greg
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
More information about the Rcpp-devel
mailing list