Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Mp11 #62

Closed
nbenn opened this issue Aug 10, 2019 · 5 comments · Fixed by #65
Closed

Adding Mp11 #62

nbenn opened this issue Aug 10, 2019 · 5 comments · Fixed by #65

Comments

@nbenn
Copy link

@nbenn nbenn commented Aug 10, 2019

Would it be possible to add the Boost Mp11 library to BH? I believe it‘s header-only.

@eddelbuettel

This comment has been minimized.

Copy link
Owner

@eddelbuettel eddelbuettel commented Aug 10, 2019

Looks useful, so let's add it at the next round (which may be a few months off though, at least as a full CRAN release).

Have you used Mp11 yet?

@nbenn

This comment has been minimized.

Copy link
Author

@nbenn nbenn commented Aug 11, 2019

I'm currently using Mp11 in a package as a solution to roughly the following problem:

  1. I create an object like an arma::Mat<int> or arma::SpMat<double> and hold onto it via an Rcpp::Xptr
  2. When passing the SEXP representing the Xptr back to C++, I need to remember the original type and instantiate the Xptr again using the correct type (as template parameter).

How I'm doing this is outlined in my answer to my own SO question. If you're interested in having a look and have an opinion on the sensibility/execution of my undertaking, I'd be keen on hearing about it (no pressure, just in case you're interested).

To my untrained eye, Mp11 looks like a work of art, I did enjoy learning about it during the past days a lot.

Side note

The kludgy recursive type list interation, I implemented myself will no longer be necessary as soon as Rtools 40 goes out of beta and c++14 features become available. This will allow for very succinct implementation of what I'm after, by using mp11::mp_with_index (providing iteration, most likely in a more robust way than I came up with) and generic lambdas (instead of function objects).

@nbenn

This comment has been minimized.

Copy link
Author

@nbenn nbenn commented Aug 11, 2019

I'll fork bh and add Mp11 for my own use for the time being. If you're interested, I can open a PR.

@eddelbuettel

This comment has been minimized.

Copy link
Owner

@eddelbuettel eddelbuettel commented Aug 11, 2019

Forking is a good approach for now. The procedure is pretty straightforward -- see the file local/scripts/CreateBoost.sh to which you'd add mp11 under boostextra. After that I have to do some polishing to comply with CRAN Policies (i.e. need to shorten some path and some stuff) which is documented in ChangeLog and NEWS and which you don't need for a local package. That should get you going.

And I probably don't need a PR for the one-line change to add mp11 ... but the testing is appreciated,

@eddelbuettel

This comment has been minimized.

Copy link
Owner

@eddelbuettel eddelbuettel commented Dec 15, 2019

Preparing BH 1.72.0 now based on last week's Boost 1.72 release -- with mp11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.