MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / Intersect

Method Intersect

inst/include/Rcpp/sugar/functions/setdiff.h:105–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103 typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE ;
104
105 Intersect( const LHS_T& lhs, const RHS_T& rhs) :
106 intersect()
107 {
108
109 SET lhs_set( get_const_begin(lhs), get_const_end(lhs) ) ;
110 SET rhs_set( get_const_begin(rhs), get_const_end(rhs) ) ;
111
112 ITERATOR end = lhs_set.end() ;
113 ITERATOR rhs_end = rhs_set.end() ;
114 for( ITERATOR it=lhs_set.begin(); it != end; it++){
115 if( rhs_set.find(*it) != rhs_end ) intersect.insert(*it) ;
116 }
117 }
118
119 Vector<RTYPE> get() const {
120 R_xlen_t n = intersect.size() ;

Callers

nothing calls this directly

Calls 5

get_const_beginFunction · 0.85
get_const_endFunction · 0.85
endMethod · 0.45
beginMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected