MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / GreedyVector

Method GreedyVector

inst/include/Rcpp/internal/GreedyVector.h:29–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 typedef typename std::vector<T>::const_iterator const_iterator;
28
29 GreedyVector(SEXP vec) : v(0){
30 if (!Rf_isNumeric(vec) || Rf_isMatrix(vec) || Rf_isLogical(vec))
31 throw std::range_error("invalid numeric vector in constructor");
32 int len = Rf_length(vec);
33 if (len == 0)
34 throw std::range_error("null vector in constructor");
35 v.resize(len);
36 for (int i = 0; i < len; i++)
37 v[i] = T( static_cast<double>(REAL(vec)[i]));
38 }
39
40 GreedyVector(int n) : v(n){}
41

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected