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

Function check_single_string

inst/include/Rcpp/as.h:46–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 }
45
46 inline const char* check_single_string(SEXP x) {
47 if (TYPEOF(x) == CHARSXP) return CHAR(x); // #nocov start
48 if (! ::Rf_isString(x) || Rf_length(x) != 1) {
49 const char* fmt = "Expecting a single string value: "
50 "[type=%s; extent=%i].";
51 throw ::Rcpp::not_compatible(fmt,
52 Rf_type2char(TYPEOF(x)),
53 Rf_length(x));
54 } // #nocov end
55
56 return CHAR(STRING_ELT(::Rcpp::r_cast<STRSXP>(x), 0));
57 }
58
59
60 template <typename T> T as_string(SEXP x, Rcpp::traits::true_type) {

Callers 2

as_stringFunction · 0.85
as<char>Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected