[Rcpp-devel] List of Lists to List of Vectors
Matt D.
matdzb at gmail.com
Sat May 2 21:57:52 CEST 2015
On 5/2/2015 20:18, Dirk Eddelbuettel wrote:
> On 2 May 2015 at 10:49, William Dunlap wrote:
> | Since translation from R to Rcpp is "seamless" I will leave that to you.
>
> One problem is with the strongly typed nature of C++. Rearranging dynamicly
> growing objects can be done. I think I used Boost's variant type a few
> years. I am sure there are other possibilities. We should collect a few and
> compare. But in C++ please :)
As for the other possibilities / alternatives to Boost.Variant -- the
good news is that there a plenty! :-)
The, um, related news is that the abundance means a maze of twisty
little passages, not quite all alike ;-)
There are speed / ease of use / flexibility / memory usage (and more --
e.g., involving floating-point accuracy) trade-offs.
It doesn't seem like there's any "generally best" winner -- what's best
is really use-case-specific.
"Dynamic C++" article series by Alex Fabijanic and Richard Saunders
provides a good overview with comparisons:
Part 1: http://accu.org/index.php/journals/1855
Part 2: http://accu.org/index.php/journals/1841
// Focus: "In this article series, both externals and internals of
boost::[variant, any, type_erasure], folly::dynamic, Poco::Dynamic::Var,
Qt QVariant and adobe::any_regular are explored and compared. Design,
capabilities, ease of use as well as pros and cons of each solution will
be examined. Performance benchmark comparisons results will be provided
as well. "
There's also a related presentation by Alex:
Slides:
https://github.com/boostcon/cppnow_presentations_2013/blob/master/thu/DynamicCpp.pdf?raw=true
// Online slides: http://www.slideshare.net/aleks-f/dynamic-caccu2013
Video:
https://www.youtube.com/watch?v=QySTK4cSq7o&list=PLAq3rthfTjp4O2YZ7K2Y6AzW_zx5DtUth
Code: https://github.com/aleks-f/articles/tree/master/ACCU-2013
ACCU 2014 presentation, "Dynamic C++ performance", includes more on
speed comparisons (and also floating-point conversions, including their
accuracy).
Code & slides: https://github.com/aleks-f/articles/tree/master/ACCU2014
Perhaps "Dynamic, Recursive, Heterogeneous Types in Statically-Typed
Languages" by Richard Saunders, Clinton Jeffery may also be of interest,
although it's only somewhat related to the problem (issue at hand: allow
Python and C++ to share Python dictionaries across language boundaries).
Article: http://cppnow.org/files/2013/03/saunders-jeffery.pdf
Slides:
https://github.com/boostcon/cppnow_presentations_2013/blob/master/fri/DynRec.pdf?raw=true
Video: https://www.youtube.com/watch?v=W3TsQtnMtqg
Best,
Matt
More information about the Rcpp-devel
mailing list