23#ifndef Rcpp__sugar__setdiff_h
24#define Rcpp__sugar__setdiff_h
29 template <
typename SET>
43 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
48 SetDiff(
const LHS_T& lhs,
const RHS_T& rhs) :
64 typedef std::unordered_set<STORAGE>
SET ;
65 typedef typename SET::const_iterator
ITERATOR ;
71 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
76 SetEqual(
const LHS_T& lhs,
const RHS_T& rhs) :
87 if(
rhs_set.find(*it++) == rhs_end )
return false ;
93 typedef std::unordered_set<STORAGE>
SET ;
94 typedef typename SET::const_iterator
ITERATOR ;
100 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
114 for(
ITERATOR it=lhs_set.begin(); it != end; it++){
115 if( rhs_set.find(*it) != rhs_end )
intersect.insert(*it) ;
127 typedef std::unordered_set<STORAGE>
SET ;
133 template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
138 Union(
const LHS_T& lhs,
const RHS_T& rhs) :
145 R_xlen_t n =
result.size() ;
152 typedef std::unordered_set<STORAGE>
SET ;
161template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
166template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
171template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
177template <
int RTYPE,
bool LHS_NA,
typename LHS_T,
bool RHS_NA,
typename RHS_T>
Intersect(const LHS_T &lhs, const RHS_T &rhs)
Vector< RTYPE > get() const
Rcpp::traits::storage_type< RTYPE >::type STORAGE
SET::const_iterator ITERATOR
std::unordered_set< STORAGE > SET
Vector< RTYPE > get() const
Rcpp::traits::storage_type< RTYPE >::type STORAGE
std::unordered_set< STORAGE > SET
SetDiff(const LHS_T &lhs, const RHS_T &rhs)
SET::const_iterator ITERATOR
SetEqual(const LHS_T &lhs, const RHS_T &rhs)
SET::const_iterator ITERATOR
Rcpp::traits::storage_type< RTYPE >::type STORAGE
std::unordered_set< STORAGE > SET
Union(const LHS_T &lhs, const RHS_T &rhs)
std::unordered_set< STORAGE > SET
Vector< RTYPE > get() const
Rcpp::traits::storage_type< RTYPE >::type STORAGE
SET::const_iterator ITERATOR
sugar_const_iterator_type< T >::type get_const_end(const T &obj)
sugar_const_iterator_type< T >::type get_const_begin(const T &obj)
Vector< RTYPE > union_(const VectorBase< RTYPE, LHS_NA, LHS_T > &lhs, const VectorBase< RTYPE, RHS_NA, RHS_T > &rhs)
Vector< RTYPE > intersect(const VectorBase< RTYPE, LHS_NA, LHS_T > &lhs, const VectorBase< RTYPE, RHS_NA, RHS_T > &rhs)
no_init_vector no_init(R_xlen_t size)
bool setequal(const VectorBase< RTYPE, LHS_NA, LHS_T > &lhs, const VectorBase< RTYPE, RHS_NA, RHS_T > &rhs)
Vector< RTYPE > setdiff(const VectorBase< RTYPE, LHS_NA, LHS_T > &lhs, const VectorBase< RTYPE, RHS_NA, RHS_T > &rhs)