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

Method replace

inst/include/Rcpp/api/meat/DottedPairImpl.h:80–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 template <typename CLASS>
79 template <typename T>
80 void DottedPairImpl<CLASS>::replace( const int& index, const T& object ) {
81 CLASS& ref = static_cast<CLASS&>(*this) ;
82 if( static_cast<R_xlen_t>(index) >= ::Rf_xlength(ref.get__()) ) {
83 const char* fmt = "Dotted Pair index is out of bounds: "
84 "[index=%i; extent=%i].";
85
86 throw index_out_of_bounds(fmt,
87 static_cast<R_xlen_t>(index),
88 ::Rf_xlength(ref.get__()) ) ;
89 }
90
91 Shield<SEXP> x( pairlist( object ) );
92 SEXP y = ref.get__() ;
93 int i=0;
94 while( i<index ){ y = CDR(y) ; i++; }
95
96 SETCAR( y, CAR(x) );
97 SET_TAG( y, TAG(x) );
98 }
99
100 template <typename CLASS>
101 void DottedPairImpl<CLASS>::remove( const size_t& index ) {

Callers 3

runit_pl_replaceFunction · 0.80
demangler_oneFunction · 0.80
StringClass · 0.80

Calls 2

pairlistFunction · 0.85
get__Method · 0.45

Tested by

no test coverage detected