| 99 | |
| 100 | template <typename CLASS> |
| 101 | void DottedPairImpl<CLASS>::remove( const size_t& index ) { |
| 102 | CLASS& ref = static_cast<CLASS&>(*this) ; |
| 103 | if( static_cast<R_xlen_t>(index) >= Rf_xlength(ref.get__()) ) { |
| 104 | const char* fmt = "Dotted Pair index is out of bounds: " |
| 105 | "[index=%i; extent=%i]."; |
| 106 | |
| 107 | throw index_out_of_bounds(fmt, |
| 108 | static_cast<R_xlen_t>(index), |
| 109 | ::Rf_xlength(ref.get__()) ) ; |
| 110 | } |
| 111 | |
| 112 | if( index == 0 ){ |
| 113 | ref.set__( CDR( ref.get__() ) ) ; |
| 114 | } else{ |
| 115 | SEXP x = ref.get__() ; |
| 116 | size_t i=1; |
| 117 | while( i<index ){ x = CDR(x) ; i++; } |
| 118 | SETCDR( x, CDDR(x) ) ; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | |
| 123 |
no test coverage detected