cpp11
cpp11 copied to clipboard
cpp11 helps you to interact with R objects using C++ code.
```r cpp11::cpp_function(" SEXP f() { cpp11::writable::integers foo({1, 2, 3}); std::for_each(foo.begin(), foo.end(), [](int& m) {m;}); return R_NilValue; } ") ``` ``` using C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’ using C++11...
Using the `std::max_element()` algorithm on a writable vector results in a compile error. The error is not present when using a non-writable vector. It is speculated that the following commit...
Examples
Hi It would be good to have a long list of examples. I created this https://github.com/pachadotdev/cpp11-r-examples for my own learning and reference.
In the documentation you describe how to create a named list: ```c++ #include [[cpp11::register]] cpp11::list foo_push() { using namespace cpp11::literals; cpp11::writable::list x; x.push_back({"foo"_nm = 1}); return x; } ``` Is...
Invoking the move constructor of `external_pointer` clears attributes on an external pointer object. I would expect the third and fourth output to be identical to the second output. A possible...
I know why this doesn't work; however it took a while to track down (and I didn't find help elsewhere) - so at least if I put this here it...
Follow up to #316
Thanks for your work on `cpp11`! Please consider the following. In c++ the code below will produce the error: `attempt to set an attribute on NULL` ```cpp // Create an...
Currently, a `nullptr` but not an `R_NilValue` can be assigned to an `external_ptr` object. This is inconsistent and surprising, in particular because the roundtrip works correctly the other way. Should...
This seems fairly restrictive? I feel like you should be able to copy proxy elements of the same type from one writable vector to another. ``` r cpp11::cpp_function(" cpp11::writable::doubles test()...