22 #ifndef Rcpp__sugar__table_h
23 #define Rcpp__sugar__table_h
28 template <
typename HASH,
typename STORAGE>
41 template <
typename HASH,
int RTYPE>
49 names[
index++] = internal::r_coerce<RTYPE,STRSXP>(pair.first) ;
62 template <
int RTYPE,
typename TABLE_T>
72 R_xlen_t n =
hash.size() ;
75 std::for_each(
hash.begin(),
hash.end(), Grabber<HASH, RTYPE>(
result, names) ) ;
81 typedef RCPP_UNORDERED_MAP<STORAGE, int, internal::NAComparator<STORAGE> >
HASH ;
82 typedef CountInserter<HASH,STORAGE>
Inserter ;
88 template <
int RTYPE,
typename TABLE_T>
103 R_xlen_t n =
map.size() ;
112 typedef RCPP_UNORDERED_MAP<STORAGE, int>
HASH ;
116 typedef std::map<STORAGE, int, internal::NAComparator<STORAGE> >
SORTED_MAP ;
125 template <
int RTYPE,
bool NA,
typename T>
void operator()(STORAGE value)
CountInserter(HASH &hash_)
Grabber(IntegerVector &res_, CharacterVector &names_)
RCPP_UNORDERED_MAP< STORAGE, int > HASH
std::map< STORAGE, int, internal::NAComparator< STORAGE > > SORTED_MAP
Table(const TABLE_T &table)
Rcpp::traits::storage_type< RTYPE >::type STORAGE
CountInserter< HASH, STORAGE > Inserter
no_init_vector no_init(R_xlen_t size)
Vector< INTSXP > IntegerVector
IntegerVector table(const VectorBase< RTYPE, NA, T > &x)