| 670 | } |
| 671 | |
| 672 | void push_back_name__impl(const stored_type& object, const std::string& name, traits::true_type ) { |
| 673 | Shield<SEXP> object_sexp( object ) ; |
| 674 | R_xlen_t n = size() ; |
| 675 | Vector target( n + 1 ) ; |
| 676 | iterator target_it( target.begin() ) ; |
| 677 | iterator it(begin()) ; |
| 678 | iterator this_end(end()); |
| 679 | SEXP names = RCPP_GET_NAMES(Storage::get__()) ; |
| 680 | Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n+1 ) ) ; |
| 681 | int i=0; |
| 682 | if( Rf_isNull(names) ){ |
| 683 | for( ; it < this_end; ++it, ++target_it,i++ ){ |
| 684 | *target_it = *it ; // #nocov |
| 685 | SET_STRING_ELT( newnames, i , R_BlankString ); // #nocov |
| 686 | } |
| 687 | } else { |
| 688 | for( ; it < this_end; ++it, ++target_it, i++ ){ |
| 689 | *target_it = *it ; |
| 690 | SET_STRING_ELT( newnames, i, STRING_ELT(names, i ) ) ; |
| 691 | } |
| 692 | } |
| 693 | SET_STRING_ELT( newnames, i, Rf_mkChar( name.c_str() ) ); |
| 694 | target.attr("names") = newnames ; |
| 695 | |
| 696 | *target_it = object_sexp; |
| 697 | Storage::set__( target.get__() ) ; |
| 698 | } |
| 699 | void push_back_name__impl(const stored_type& object, const std::string& name, traits::false_type ) { |
| 700 | R_xlen_t n = size() ; |
| 701 | Vector target( n + 1 ) ; |