@@ -228,22 +228,23 @@ class SubsetProxy {
228
228
229
229
public:
230
230
231
- #define RCPP_GENERATE_SUBSET_PROXY_OPERATOR (__OPERATOR__ ) \
232
- template <int RTYPE_OTHER, template <class > class StoragePolicyOther , \
233
- int RHS_RTYPE_OTHER, bool RHS_NA_OTHER, typename RHS_T_OTHER> \
234
- SubsetProxy& operator __OPERATOR__ ( \
235
- const SubsetProxy<RTYPE_OTHER, StoragePolicyOther, RHS_RTYPE_OTHER, \
236
- RHS_NA_OTHER, RHS_T_OTHER>& other) { \
237
- if (other.indices_n == 1 ) { \
238
- for (int i = 0 ; i < indices_n; ++i) \
239
- lhs[indices[i]] __OPERATOR__ ## = other.lhs [other.indices [0 ]]; \
240
- } else if (indices_n == other.indices_n ) { \
241
- for (int i = 0 ; i < indices_n; ++i) \
242
- lhs[indices[i]] __OPERATOR__ ## = other.lhs [other.indices [i]]; \
243
- } else { \
244
- stop (" index error" ); \
245
- } \
246
- return *this ; \
231
+ #define RCPP_GENERATE_SUBSET_PROXY_OPERATOR (__OPERATOR__ ) \
232
+ template <int RTYPE_OTHER, template <class > class StoragePolicyOther , \
233
+ int RHS_RTYPE_OTHER, bool RHS_NA_OTHER, typename RHS_T_OTHER> \
234
+ Vector<RTYPE, StoragePolicy> operator __OPERATOR__ ( \
235
+ const SubsetProxy<RTYPE_OTHER, StoragePolicyOther, RHS_RTYPE_OTHER, \
236
+ RHS_NA_OTHER, RHS_T_OTHER>& other) { \
237
+ Vector<RTYPE, StoragePolicy> result (indices_n); \
238
+ if (other.indices_n == 1 ) { \
239
+ for (int i = 0 ; i < indices_n; ++i) \
240
+ result[i] = lhs[indices[i]] __OPERATOR__ other.lhs [other.indices [0 ]]; \
241
+ } else if (indices_n == other.indices_n ) { \
242
+ for (int i = 0 ; i < indices_n; ++i) \
243
+ result[i] = lhs[indices[i]] __OPERATOR__ other.lhs [other.indices [i]]; \
244
+ } else { \
245
+ stop (" index error" ); \
246
+ } \
247
+ return result; \
247
248
}
248
249
249
250
RCPP_GENERATE_SUBSET_PROXY_OPERATOR (+)
0 commit comments