18 #ifndef Rcpp_api_meat_DottedPairImpl_h
19 #define Rcpp_api_meat_DottedPairImpl_h
23 template <
typename CLASS>
26 CLASS& ref =
static_cast<CLASS&
>(*this) ;
27 ref.set__(
grow(
object, ref.get__() ) ) ;
30 template <
typename CLASS>
33 CLASS& ref =
static_cast<CLASS&
>(*this) ;
35 ref.set__(
grow(
object, ref.get__() ) ) ;
37 SEXP x = ref.get__() ;
39 while( !Rf_isNull(CDR(x)) ){
47 template <
typename CLASS>
50 CLASS& ref =
static_cast<CLASS&
>(*this) ;
55 throw index_out_of_bounds(
"Object being inserted into Dotted Pair is null.");
58 if(
static_cast<R_xlen_t
>(index) > ::Rf_xlength(ref.get__()) ) {
59 const char* fmt =
"Dotted Pair index is out of bounds: "
60 "[index=%i; extent=%i].";
62 throw index_out_of_bounds(fmt,
63 static_cast<R_xlen_t
>(index),
64 ::Rf_xlength(ref.get__()) ) ;
68 SEXP x = ref.get__() ;
78 template <
typename CLASS>
81 CLASS& ref =
static_cast<CLASS&
>(*this) ;
82 if(
static_cast<R_xlen_t
>(index) >= ::Rf_xlength(ref.get__()) ) {
83 const char* fmt =
"Dotted Pair index is out of bounds: "
84 "[index=%i; extent=%i].";
86 throw index_out_of_bounds(fmt,
87 static_cast<R_xlen_t
>(index),
88 ::Rf_xlength(ref.get__()) ) ;
92 SEXP y = ref.get__() ;
94 while( i<index ){ y = CDR(y) ; i++; }
100 template <
typename CLASS>
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].";
107 throw index_out_of_bounds(fmt,
108 static_cast<R_xlen_t
>(index),
109 ::Rf_xlength(ref.get__()) ) ;
113 ref.set__( CDR( ref.get__() ) ) ;
115 SEXP x = ref.get__() ;
117 while( i<index ){ x = CDR(x) ; i++; }
118 SETCDR( x, CDDR(x) ) ;
void push_back(const T &object)
void replace(const int &index, const T &object)
void remove(const size_t &index)
void insert(const size_t &index, const T &object)
void push_front(const T &object)
StretchyList_Impl & push_front(const T &obj)
sugar::Tail< RTYPE, NA, T > tail(const VectorBase< RTYPE, NA, T > &t, R_xlen_t n)
SEXP grow(SEXP head, SEXP tail)