22 #ifndef Rcpp__sugar__sum_h
23 #define Rcpp__sugar__sum_h
28 template <
int RTYPE,
bool NA,
typename T>
29 class Sum :
public Lazy< typename Rcpp::traits::storage_type<RTYPE>::type , Sum<RTYPE,NA,T> > {
39 R_xlen_t n =
object.size() ;
41 for( R_xlen_t i=0; i<n; i++){
43 if( Rcpp::traits::is_na<RTYPE>(current) )
44 return Rcpp::traits::get_na<RTYPE>() ;
53 template <
bool NA,
typename T>
54 class Sum<REALSXP,
NA,T> :
public Lazy< double , Sum<REALSXP,NA,T> > {
63 R_xlen_t n =
object.size() ;
64 for( R_xlen_t i=0; i<n; i++){
74 template <
int RTYPE,
typename T>
75 class Sum<RTYPE,false,T> :
public Lazy< typename Rcpp::traits::storage_type<RTYPE>::type , Sum<RTYPE,false,T> > {
85 R_xlen_t n =
object.size() ;
86 for( R_xlen_t i=0; i<n; i++){
97 template <
bool NA,
typename T>
102 template <
bool NA,
typename T>
107 template <
bool NA,
typename T>
Rcpp::traits::Extractor< REALSXP, NA, T >::type VEC_EXT
Rcpp::VectorBase< REALSXP, NA, T > VEC_TYPE
Sum(const VEC_TYPE &object_)
Rcpp::traits::storage_type< RTYPE >::type STORAGE
Rcpp::VectorBase< RTYPE, false, T > VEC_TYPE
Sum(const VEC_TYPE &object_)
Rcpp::traits::Extractor< RTYPE, false, T >::type VEC_EXT
Rcpp::traits::Extractor< RTYPE, NA, T >::type VEC_EXT
Rcpp::VectorBase< RTYPE, NA, T > VEC_TYPE
Rcpp::traits::storage_type< RTYPE >::type STORAGE
Sum(const VEC_TYPE &object_)
sugar::Sum< INTSXP, NA, T > sum(const VectorBase< INTSXP, NA, T > &t)