| 619 | private: |
| 620 | |
| 621 | void push_back__impl(const stored_type& object, traits::true_type ) { |
| 622 | Shield<SEXP> object_sexp( object ) ; |
| 623 | R_xlen_t n = size() ; |
| 624 | Vector target( n + 1 ) ; |
| 625 | SEXP names = RCPP_GET_NAMES(Storage::get__()) ; |
| 626 | iterator target_it( target.begin() ) ; |
| 627 | iterator it(begin()) ; |
| 628 | iterator this_end(end()); |
| 629 | if( Rf_isNull(names) ){ |
| 630 | for( ; it < this_end; ++it, ++target_it ){ |
| 631 | *target_it = *it ; // #nocov start |
| 632 | } |
| 633 | } else { |
| 634 | Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n + 1) ) ; |
| 635 | int i = 0 ; |
| 636 | for( ; it < this_end; ++it, ++target_it, i++ ){ |
| 637 | *target_it = *it ; |
| 638 | SET_STRING_ELT( newnames, i, STRING_ELT(names, i ) ) ; |
| 639 | } |
| 640 | SET_STRING_ELT( newnames, i, Rf_mkChar("") ) ; |
| 641 | target.attr("names") = newnames ; // #nocov end |
| 642 | } |
| 643 | *target_it = object_sexp; |
| 644 | Storage::set__( target.get__() ) ; |
| 645 | } |
| 646 | |
| 647 | void push_back__impl(const stored_type& object, traits::false_type ) { |
| 648 | R_xlen_t n = size() ; |