Thanks Dirk and Kevin. That cleared a lot of things up.
Best, Simon Am 16.08.18 um 17:52 schrieb Dirk Eddelbuettel:
On 16 August 2018 at 08:43, Kevin Ushey wrote: | I think the main problem is that it's easy to use your class incorrectly. | For example: | | - What happens if your map is destructed? The SEXPs it is handling are | effectively leaked. | - What if you copy your map? Since SEXPs are pointers, you now have two | maps containing the same pointers, and if you were to attempt to remove a | SEXP from both maps problems would occur. | | Rather than attempting to manage the lifetime of these R objects in your | map's methods, it's better to have wrapper classes that manage the lifetime | of a single SEXP -- ie, what Rcpp does with its classes. | | You might consider just using e.g. std::unordered_map<T, Rcpp::RObject> if | you need to map some arbitrary types to R objects. +1, or "what he said" which I generally have on auto-loop for Kevin anyway ... Dirk
_______________________________________________ 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