| 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); |