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

Method check_indices

inst/include/Rcpp/vector/Subsetter.h:137–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135
136 template <typename IDX>
137 void check_indices(IDX* x, R_xlen_t n, R_xlen_t size) {
138#ifndef RCPP_NO_BOUNDS_CHECK
139 for (IDX i=0; i < n; ++i) {
140 if (x[i] < 0 or x[i] >= size) {
141 if(std::numeric_limits<IDX>::is_integer && size > std::numeric_limits<IDX>::max()) {
142 stop("use NumericVector to index an object of length %td", size);
143 }
144 stop("index error");
145 }
146 }
147#endif
148 }
149
150 void get_indices( traits::identity< traits::int2type<INTSXP> > t ) {
151 indices.reserve(rhs_n);

Callers

nothing calls this directly

Calls 2

stopFunction · 0.85
maxFunction · 0.50

Tested by

no test coverage detected