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

Method set

inst/include/Rcpp/proxy/NamesProxy.h:49–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48
49 void set(SEXP x) {
50 Shield<SEXP> safe_x(x);
51
52 /* check if we can use a fast version */
53 if( TYPEOF(x) == STRSXP && parent.size() == Rf_length(x) ){ // #nocov start
54 Rf_namesgets(parent, x);
55 } else {
56 /* use the slower and more flexible version (callback to R) */
57 SEXP namesSym = Rf_install( "names<-" );
58 Shield<SEXP> call(Rf_lang3(namesSym, parent, x));
59 Shield<SEXP> new_vec(Rcpp_fast_eval(call, R_GlobalEnv));
60 parent.set__(new_vec); // #nocov end
61 }
62
63 }
64
65 } ;
66

Callers

nothing calls this directly

Calls 3

Rcpp_fast_evalFunction · 0.85
sizeMethod · 0.45
set__Method · 0.45

Tested by

no test coverage detected