22 #ifndef Rcpp__sugar__plus_h
23 #define Rcpp__sugar__plus_h
28 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T >
43 if( traits::is_na<RTYPE>(lhs_) )
return lhs_ ;
45 return traits::is_na<RTYPE>(rhs_) ? rhs_ : (lhs_ + rhs_) ;
48 inline R_xlen_t
size()
const {
return lhs.size() ; }
58 template <
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T >
60 public Rcpp::VectorBase<REALSXP, true , Plus_Vector_Vector<REALSXP,LHS_NA,LHS_T,RHS_NA,RHS_T> > {
75 inline R_xlen_t
size()
const {
return lhs.size() ; }
86 template <
int RTYPE,
typename LHS_T,
bool RHS_NA,
typename RHS_T >
87 class Plus_Vector_Vector<RTYPE,false,LHS_T,RHS_NA,RHS_T> :
public Rcpp::VectorBase<RTYPE,true, Plus_Vector_Vector<RTYPE,false,LHS_T,RHS_NA,RHS_T> > {
101 if( traits::is_na<RTYPE>(rhs_) )
return rhs_ ;
102 return lhs[i] + rhs_ ;
105 inline R_xlen_t
size()
const {
return lhs.size() ; }
112 template <
typename LHS_T,
bool RHS_NA,
typename RHS_T >
114 public Rcpp::VectorBase<REALSXP,true, Plus_Vector_Vector<REALSXP,false,LHS_T,RHS_NA,RHS_T> > {
129 inline R_xlen_t
size()
const {
return lhs.size() ; }
139 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
typename RHS_T >
140 class Plus_Vector_Vector<RTYPE,LHS_NA,LHS_T,false,RHS_T> :
public Rcpp::VectorBase<RTYPE, true , Plus_Vector_Vector<RTYPE,LHS_NA,LHS_T,false,RHS_T> > {
154 if( traits::is_na<RTYPE>(lhs_) )
return lhs_ ;
155 return lhs_ +
rhs[i] ;
158 inline R_xlen_t
size()
const {
return lhs.size() ; }
165 template <
bool LHS_NA,
typename LHS_T,
typename RHS_T >
167 public Rcpp::VectorBase<REALSXP, true , Plus_Vector_Vector<REALSXP,LHS_NA,LHS_T,false,RHS_T> > {
182 inline R_xlen_t
size()
const {
return lhs.size() ; }
193 template <
int RTYPE,
typename LHS_T,
typename RHS_T >
194 class Plus_Vector_Vector<RTYPE,false,LHS_T,false,RHS_T> :
public Rcpp::VectorBase<RTYPE, false , Plus_Vector_Vector<RTYPE,false,LHS_T,false,RHS_T> > {
210 inline R_xlen_t
size()
const {
return lhs.size() ; }
217 template <
typename LHS_T,
typename RHS_T >
219 public Rcpp::VectorBase<REALSXP, false , Plus_Vector_Vector<REALSXP,false,LHS_T,false,RHS_T> > {
234 inline R_xlen_t
size()
const {
return lhs.size() ; }
247 template <
int RTYPE,
bool NA,
typename T>
263 return Rcpp::traits::is_na<RTYPE>(x) ? x : (x +
rhs) ;
266 inline R_xlen_t
size()
const {
return lhs.size() ; }
275 template <
bool NA,
typename T>
277 public Rcpp::VectorBase<REALSXP,true, Plus_Vector_Primitive<REALSXP,NA,T> > {
290 inline R_xlen_t
size()
const {
return lhs.size() ; }
299 template <
int RTYPE,
typename T>
314 inline R_xlen_t
size()
const {
return lhs.size() ; }
322 template <
typename T>
324 public Rcpp::VectorBase<REALSXP,false, Plus_Vector_Primitive<REALSXP,false,T> > {
337 inline R_xlen_t
size()
const {
return lhs.size() ; }
350 template <
int RTYPE,
bool NA,
typename T>
363 return Rcpp::traits::is_na<RTYPE>(x) ? x : (x +
rhs) ;
366 inline R_xlen_t
size()
const {
return lhs.size() ; }
373 template <
bool NA,
typename T>
375 public Rcpp::VectorBase<REALSXP,true, Plus_Vector_Primitive_nona<REALSXP,NA,T> > {
388 inline R_xlen_t
size()
const {
return lhs.size() ; }
398 template <
int RTYPE,
typename T>
413 inline R_xlen_t
size()
const {
return lhs.size() ; }
421 template <
typename T>
423 public Rcpp::VectorBase<REALSXP,false, Plus_Vector_Primitive_nona<REALSXP,false,T> > {
435 inline R_xlen_t
size()
const {
return lhs.size() ; }
446 template <
int RTYPE,
bool NA,
typename T,
typename U>
456 template <
int RTYPE,
bool NA,
typename T,
typename U>
457 inline typename traits::enable_if<traits::is_convertible<typename traits::remove_const_and_reference<U>::type,
typename traits::storage_type<RTYPE>::type>::value,
typename sugar::Plus_Vector_Primitive< RTYPE , NA , T> >::type
467 template <
int RTYPE,
bool NA,
typename T,
typename U>
468 inline typename traits::enable_if<traits::is_convertible<typename traits::remove_const_and_reference<U>::type,
typename traits::storage_type<RTYPE>::type>::value, sugar::Plus_Vector_Primitive_nona<RTYPE,NA,T> >::type
476 template <
int RTYPE,
bool NA,
typename T,
typename U>
477 inline typename traits::enable_if<traits::is_convertible<typename traits::remove_const_and_reference<U>::type,
typename traits::storage_type<RTYPE>::type>::value, sugar::Plus_Vector_Primitive_nona< RTYPE , NA , T> >::type
486 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
487 inline sugar::Plus_Vector_Vector<
Plus_Vector_Vector< RTYPE, LHS_NA, LHS_T, RHS_NA, RHS_T > & get_ref()
Plus_Vector_Primitive(const VEC_TYPE &lhs_, double rhs_)
Rcpp::traits::Extractor< REALSXP, NA, T >::type EXT
Rcpp::VectorBase< REALSXP, NA, T > VEC_TYPE
double operator[](R_xlen_t i) const
Rcpp::traits::Extractor< REALSXP, false, T >::type EXT
double operator[](R_xlen_t i) const
Plus_Vector_Primitive(const VEC_TYPE &lhs_, double rhs_)
Rcpp::VectorBase< REALSXP, false, T > VEC_TYPE
Plus_Vector_Primitive(const VEC_TYPE &lhs_, STORAGE rhs_)
traits::storage_type< RTYPE >::type STORAGE
Rcpp::traits::Extractor< RTYPE, false, T >::type EXT
Rcpp::VectorBase< RTYPE, false, T > VEC_TYPE
STORAGE operator[](R_xlen_t i) const
Rcpp::VectorBase< REALSXP, NA, T > VEC_TYPE
Plus_Vector_Primitive_nona(const VEC_TYPE &lhs_, double rhs_)
double operator[](R_xlen_t i) const
Rcpp::traits::Extractor< REALSXP, NA, T >::type EXT
Rcpp::VectorBase< REALSXP, false, T > VEC_TYPE
Plus_Vector_Primitive_nona(const VEC_TYPE &lhs_, double rhs_)
Rcpp::traits::Extractor< REALSXP, false, T >::type EXT
double operator[](R_xlen_t i) const
Plus_Vector_Primitive_nona(const VEC_TYPE &lhs_, STORAGE rhs_)
Rcpp::traits::Extractor< RTYPE, false, T >::type EXT
traits::storage_type< RTYPE >::type STORAGE
Rcpp::VectorBase< RTYPE, false, T > VEC_TYPE
STORAGE operator[](R_xlen_t i) const
STORAGE operator[](R_xlen_t i) const
Rcpp::VectorBase< RTYPE, NA, T > VEC_TYPE
Rcpp::traits::Extractor< RTYPE, NA, T >::type EXT
Plus_Vector_Primitive_nona(const VEC_TYPE &lhs_, STORAGE rhs_)
traits::storage_type< RTYPE >::type STORAGE
Plus_Vector_Primitive(const VEC_TYPE &lhs_, STORAGE rhs_)
Rcpp::VectorBase< RTYPE, NA, T > VEC_TYPE
STORAGE operator[](R_xlen_t i) const
traits::storage_type< RTYPE >::type STORAGE
Rcpp::traits::Extractor< RTYPE, NA, T >::type EXT
double operator[](R_xlen_t i) const
Rcpp::VectorBase< REALSXP, RHS_NA, RHS_T > RHS_TYPE
Rcpp::VectorBase< REALSXP, LHS_NA, LHS_T > LHS_TYPE
Plus_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::traits::Extractor< REALSXP, RHS_NA, RHS_T >::type RHS_EXT
Rcpp::traits::Extractor< REALSXP, LHS_NA, LHS_T >::type LHS_EXT
Rcpp::VectorBase< REALSXP, false, RHS_T > RHS_TYPE
Rcpp::traits::Extractor< REALSXP, LHS_NA, LHS_T >::type LHS_EXT
Rcpp::traits::Extractor< REALSXP, false, RHS_T >::type RHS_EXT
Plus_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::VectorBase< REALSXP, LHS_NA, LHS_T > LHS_TYPE
double operator[](R_xlen_t i) const
double operator[](R_xlen_t i) const
Rcpp::VectorBase< REALSXP, false, LHS_T > LHS_TYPE
Rcpp::traits::Extractor< REALSXP, RHS_NA, RHS_T >::type RHS_EXT
Plus_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::VectorBase< REALSXP, RHS_NA, RHS_T > RHS_TYPE
Rcpp::traits::Extractor< REALSXP, false, LHS_T >::type LHS_EXT
Rcpp::traits::Extractor< REALSXP, false, LHS_T >::type LHS_EXT
Rcpp::traits::Extractor< REALSXP, false, RHS_T >::type RHS_EXT
Rcpp::VectorBase< REALSXP, false, LHS_T > LHS_TYPE
Rcpp::VectorBase< REALSXP, false, RHS_T > RHS_TYPE
double operator[](R_xlen_t i) const
Plus_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
STORAGE operator[](R_xlen_t i) const
Rcpp::traits::Extractor< RTYPE, false, RHS_T >::type RHS_EXT
Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T >::type LHS_EXT
Rcpp::VectorBase< RTYPE, LHS_NA, LHS_T > LHS_TYPE
Rcpp::VectorBase< RTYPE, false, RHS_T > RHS_TYPE
traits::storage_type< RTYPE >::type STORAGE
Plus_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::VectorBase< RTYPE, false, LHS_T > LHS_TYPE
traits::storage_type< RTYPE >::type STORAGE
Rcpp::VectorBase< RTYPE, RHS_NA, RHS_T > RHS_TYPE
Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T >::type RHS_EXT
STORAGE operator[](R_xlen_t i) const
Rcpp::traits::Extractor< RTYPE, false, LHS_T >::type LHS_EXT
Plus_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::traits::Extractor< RTYPE, false, LHS_T >::type LHS_EXT
Rcpp::traits::Extractor< RTYPE, false, RHS_T >::type RHS_EXT
traits::storage_type< RTYPE >::type STORAGE
Rcpp::VectorBase< RTYPE, false, LHS_T > LHS_TYPE
Plus_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::VectorBase< RTYPE, false, RHS_T > RHS_TYPE
STORAGE operator[](R_xlen_t i) const
STORAGE operator[](R_xlen_t i) const
traits::storage_type< RTYPE >::type STORAGE
Rcpp::VectorBase< RTYPE, RHS_NA, RHS_T > RHS_TYPE
Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T >::type LHS_EXT
Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T >::type RHS_EXT
Plus_Vector_Vector(const LHS_TYPE &lhs_, const RHS_TYPE &rhs_)
Rcpp::VectorBase< RTYPE, LHS_NA, LHS_T > LHS_TYPE
sugar::IsNa< RTYPE, NA, T > is_na(const Rcpp::VectorBase< RTYPE, NA, T > &t)
Date operator+(const Date &date, int offset)