21 #ifndef Rcpp__sugar__min_h
22 #define Rcpp__sugar__min_h
27 template <
int RTYPE,
bool NA,
typename T>
35 R_xlen_t n =
obj.size();
36 if (n == 0)
return(
static_cast<STORAGE>(R_PosInf));
40 if( Rcpp::traits::is_na<RTYPE>(
min ) )
return min ;
42 for( R_xlen_t i=1; i<n; i++){
44 if( Rcpp::traits::is_na<RTYPE>( current ) )
return current;
45 if( current <
min )
min = current ;
54 template <
int RTYPE,
typename T>
55 class Min<RTYPE,false,T> {
62 R_xlen_t n =
obj.size();
63 if (n == 0)
return(
static_cast<STORAGE>(R_PosInf));
67 for( R_xlen_t i=1; i<n; i++){
69 if( current <
min )
min = current ;
81 template <
int RTYPE,
bool NA,
typename T>
Rcpp::traits::storage_type< RTYPE >::type STORAGE
Rcpp::traits::storage_type< RTYPE >::type STORAGE
sugar::Min< RTYPE, NA, T > min(const VectorBase< RTYPE, NA, T > &x)