22#ifndef Rcpp_vector_Subsetter_h_
23#define Rcpp_vector_Subsetter_h_
30 int RTYPE,
template <
class>
class StoragePolicy,
111 if (
other.indices_n == 1) {
136 template <
typename IDX>
138#ifndef RCPP_NO_BOUNDS_CHECK
139 for (
IDX i=0; i < n; ++i) {
140 if (x[i] < 0
or x[i] >= size) {
141 if(std::numeric_limits<IDX>::is_integer && size > std::numeric_limits<IDX>::max()) {
142 stop(
"use NumericVector to index an object of length %td", size);
163 for(
size_t i = 0 ; i <
tmp.size() ; ++i) {
191 stop(
"logical subsetting requires vectors of identical size");
196 stop(
"can't subset using a logical vector with NAs");
234#define RCPP_GENERATE_SUBSET_PROXY_OPERATOR(__OPERATOR__) \
235 template <int RTYPE_OTHER, template <class> class StoragePolicyOther, \
236 int RHS_RTYPE_OTHER, bool RHS_NA_OTHER, typename RHS_T_OTHER> \
237 Vector<RTYPE, StoragePolicy> operator __OPERATOR__ ( \
238 const SubsetProxy<RTYPE_OTHER, StoragePolicyOther, RHS_RTYPE_OTHER, \
239 RHS_NA_OTHER, RHS_T_OTHER>& other) { \
240 Vector<RTYPE, StoragePolicy> result(indices_n); \
241 if (other.indices_n == 1) { \
242 for (R_xlen_t i = 0; i < indices_n; ++i) \
243 result[i] = lhs[indices[i]] __OPERATOR__ other.lhs[other.indices[0]]; \
244 } else if (indices_n == other.indices_n) { \
245 for (R_xlen_t i = 0; i < indices_n; ++i) \
246 result[i] = lhs[indices[i]] __OPERATOR__ other.lhs[other.indices[i]]; \
248 stop("index error"); \
258#undef RCPP_GENERATE_SUBSET_PROXY_OPERATOR
#define RCPP_GENERATE_SUBSET_PROXY_OPERATOR(__OPERATOR__)
SubsetProxy & operator=(bool other)
void get_indices(traits::identity< traits::int2type< REALSXP > > t)
void get_indices(traits::identity< traits::int2type< STRSXP > > t)
SubsetProxy & operator=(const char *other)
void get_indices(traits::identity< traits::int2type< LGLSXP > > t)
SubsetProxy & operator=(int other)
SubsetProxy & operator=(const SubsetProxy< RTYPE_OTHER, StoragePolicyOther, RHS_RTYPE_OTHER, RHS_NA_OTHER, RHS_T_OTHER > &other)
SubsetProxy & operator=(const Vector< OtherRTYPE, OtherStoragePolicy > &other)
SubsetProxy & operator=(double other)
void check_indices(IDX *x, R_xlen_t n, R_xlen_t size)
void get_indices(traits::identity< traits::int2type< INTSXP > > t)
SubsetProxy(const SubsetProxy &other)
Vector< RTYPE, StoragePolicy > get_vec() const
std::vector< R_xlen_t > indices
SubsetProxy & operator=(const SubsetProxy &other)
SubsetProxy(LHS_t &lhs_, const RHS_t &rhs_)
Vector< RHS_RTYPE, StoragePolicy > RHS_t
Vector< RTYPE, StoragePolicy > LHS_t
void NORET stop(const std::string &message)
no_init_vector no_init(R_xlen_t size)
IntegerVector match(const VectorBase< RTYPE, NA, T > &x, const VectorBase< RTYPE, RHS_NA, RHS_T > &table_)
SEXP wrap(const Date &date)