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

Function r_cast

inst/include/Rcpp/r_cast.h:158–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 } // namespace internal
157
158 template <int TARGET> SEXP r_cast(SEXP x) { // #nocov start
159 if (TYPEOF(x) == TARGET) {
160 return x;
161 } else {
162 #ifdef RCPP_WARN_ON_COERCE
163 Shield<SEXP> result( internal::r_true_cast<TARGET>(x) );
164 ::Rcpp::warning("Coerced object from '%s' to '%s'.",
165 Rf_type2char(TYPEOF(x)),
166 Rf_type2char(TARGET)
167 );
168 return result;
169 #else
170 return internal::r_true_cast<TARGET>(x); // #nocov end
171 #endif
172 }
173 }
174
175} // namespace Rcpp
176

Callers

nothing calls this directly

Calls 1

warningFunction · 0.85

Tested by

no test coverage detected