We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9a448a commit a43c44cCopy full SHA for a43c44c
inst/include/Rcpp/vector/Subsetter.h
@@ -52,9 +52,9 @@ class SubsetProxy {
52
template <int OtherRTYPE, template <class> class OtherStoragePolicy>
53
SubsetProxy& operator=(const Vector<OtherRTYPE, OtherStoragePolicy>& other) {
54
int n = other.size();
55
- if (indices_n != n) stop("index error");
+
56
if (n == 1) {
57
- for (int i=0; i < n; ++i) {
+ for (int i=0; i < indices_n; ++i) {
58
lhs[ indices[i] ] = other[0];
59
}
60
} else if (n == indices_n) {
@@ -65,7 +65,7 @@ class SubsetProxy {
65
stop("index error");
66
67
return *this;
68
- }
+ }
69
70
// Enable e.g. x[y] = 1;
71
// TODO: std::enable_if<primitive> with C++11
0 commit comments