Rcpp11 / attributes

Standalone implementation of Rcpp attributes.
Other
3 stars 1 forks source link

Rcpp::depends(BH) #19

Closed romainfrancois closed 10 years ago

romainfrancois commented 10 years ago
#include <Rcpp.h>
#include <boost/range/irange.hpp>

// [[Rcpp::depends(BH)]]

// [[Rcpp::export]]
int useCpp11() {
    auto sum = 0;
    for(auto i : boost::irange(0,4)) { sum += i; }
    return sum;
}

produces:

romain@sherlock ~ $ Rcpp11Script /tmp/boost.cpp
Error in sprintf("%s::%s", expr[[1L]][[2L]], expr[[1L]][[3L]]) :
  invalid type of argument[1]: 'symbol'
Calls: sourceCpp -> parse_attributes -> sprintf
Execution halted
eddelbuettel commented 10 years ago

Just in case anybody gets here via Google looking for Rcpp and BH: it does of course work as expected with the Rcpp package (though Boost / BH generates many warning unless -Wno-unsued-local-typedefs is added).

R> sourceCpp("/tmp/boost.cpp")
R> useCpp11()
[1] 6
R>