| 779 | } |
| 780 | |
| 781 | void push_front_name__impl(const stored_type& object, const std::string& name, traits::true_type ) { |
| 782 | Shield<SEXP> object_sexp(object) ; |
| 783 | R_xlen_t n = size() ; |
| 784 | Vector target( n + 1 ) ; |
| 785 | iterator target_it( target.begin() ) ; |
| 786 | iterator it(begin()) ; |
| 787 | iterator this_end(end()); |
| 788 | SEXP names = RCPP_GET_NAMES(Storage::get__()) ; |
| 789 | Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n+1 ) ) ; |
| 790 | int i=1; |
| 791 | SET_STRING_ELT( newnames, 0, Rf_mkChar( name.c_str() ) ); |
| 792 | *target_it = object_sexp; |
| 793 | ++target_it ; |
| 794 | |
| 795 | if( Rf_isNull(names) ){ |
| 796 | for( ; it < this_end; ++it, ++target_it,i++ ){ |
| 797 | *target_it = *it ; |
| 798 | SET_STRING_ELT( newnames, i , R_BlankString ); |
| 799 | } |
| 800 | } else { |
| 801 | for( ; it < this_end; ++it, ++target_it, i++ ){ |
| 802 | *target_it = *it ; |
| 803 | SET_STRING_ELT( newnames, i, STRING_ELT(names, i-1 ) ) ; |
| 804 | } |
| 805 | } |
| 806 | target.attr("names") = newnames ; |
| 807 | Storage::set__( target.get__() ) ; |
| 808 | |
| 809 | } |
| 810 | void push_front_name__impl(const stored_type& object, const std::string& name, traits::false_type ) { |
| 811 | R_xlen_t n = size() ; |
| 812 | Vector target( n + 1 ) ; |