Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4f168e6

Browse files
committed
more informative error in case of excess index
1 parente5facae commit4f168e6

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

‎ChangeLog‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2018-11-11 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* inst/include/Rcpp/vector/Subsetter.h (check_indices): More
4+
informative error message as suggested by KK
5+
16
2018-11-09 William Nolan <will@landale.net>
27

38
* inst/include/Rcpp/vector/Subsetter.h: Fixed to use R_xlen_t instead

‎inst/include/Rcpp/vector/Subsetter.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class SubsetProxy {
6767
stop("index error");
6868
}
6969
return *this;
70-
}
70+
}
7171

7272
// Enable e.g. x[y] = 1;
7373
// TODO: std::enable_if<primitive> with C++11
@@ -139,7 +139,7 @@ class SubsetProxy {
139139
for (IDX i=0; i < n; ++i) {
140140
if (x[i] <0or x[i] >= size) {
141141
if(std::numeric_limits<IDX>::is_integer && size > std::numeric_limits<IDX>::max()) {
142-
stop("use NumericVector to index an object ofthis size");
142+
stop("use NumericVector to index an object oflength %td", size);
143143
}
144144
stop("index error");
145145
}
@@ -157,7 +157,7 @@ class SubsetProxy {
157157
for (R_xlen_t i=0; i < rhs_n; ++i) {
158158
indices.push_back( rhs[i] );
159159
}
160-
indices_n = rhs_n;
160+
indices_n = rhs_n;
161161
}
162162

163163
voidget_indices( traits::identity< traits::int2type<REALSXP> > t ) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp