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

Method push_front__impl

inst/include/Rcpp/vector/Vector.h:727–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725 }
726
727 void push_front__impl(const stored_type& object, traits::true_type ) {
728 Shield<SEXP> object_sexp( object ) ;
729 R_xlen_t n = size() ;
730 Vector target( n+1);
731 iterator target_it(target.begin());
732 iterator it(begin());
733 iterator this_end(end());
734 *target_it = object_sexp ;
735 ++target_it ;
736 SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
737 if( Rf_isNull(names) ){
738 for( ; it<this_end; ++it, ++target_it){
739 *target_it = *it ;
740 }
741 } else{
742 Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n + 1) );
743 int i=1 ;
744 SET_STRING_ELT( newnames, 0, Rf_mkChar("") ) ;
745 for( ; it<this_end; ++it, ++target_it, i++){
746 *target_it = *it ;
747 SET_STRING_ELT( newnames, i, STRING_ELT(names, i-1 ) ) ;
748 }
749 target.attr("names") = newnames ;
750 }
751 Storage::set__( target.get__() ) ;
752
753 }
754 void push_front__impl(const stored_type& object, traits::false_type ) {
755 R_xlen_t n = size() ;
756 Vector target( n+1);

Callers

nothing calls this directly

Calls 3

attrMethod · 0.80
beginMethod · 0.45
get__Method · 0.45

Tested by

no test coverage detected