@@ -142,17 +142,17 @@ class GrowableArrayView : public GrowableArrayBase {
142
142
}
143
143
144
144
E& at (int i) {
145
- assert (0 <= i && i < _len, " illegal index" );
145
+ assert (0 <= i && i < _len, " illegal index %d for length %d " , i, _len );
146
146
return _data[i];
147
147
}
148
148
149
149
E const & at (int i) const {
150
- assert (0 <= i && i < _len, " illegal index" );
150
+ assert (0 <= i && i < _len, " illegal index %d for length %d " , i, _len );
151
151
return _data[i];
152
152
}
153
153
154
154
E* adr_at (int i) const {
155
- assert (0 <= i && i < _len, " illegal index" );
155
+ assert (0 <= i && i < _len, " illegal index %d for length %d " , i, _len );
156
156
return &_data[i];
157
157
}
158
158
@@ -184,7 +184,7 @@ class GrowableArrayView : public GrowableArrayBase {
184
184
}
185
185
186
186
void at_put (int i, const E& elem) {
187
- assert (0 <= i && i < _len, " illegal index" );
187
+ assert (0 <= i && i < _len, " illegal index %d for length %d " , i, _len );
188
188
_data[i] = elem;
189
189
}
190
190
@@ -245,7 +245,7 @@ class GrowableArrayView : public GrowableArrayBase {
245
245
}
246
246
247
247
void remove_at (int index) {
248
- assert (0 <= index && index < _len, " illegal index" );
248
+ assert (0 <= index && index < _len, " illegal index %d for length %d " , index , _len );
249
249
for (int j = index + 1 ; j < _len; j++) {
250
250
_data[j-1 ] = _data[j];
251
251
}
@@ -262,7 +262,7 @@ class GrowableArrayView : public GrowableArrayBase {
262
262
263
263
// The order is changed.
264
264
void delete_at (int index) {
265
- assert (0 <= index && index < _len, " illegal index" );
265
+ assert (0 <= index && index < _len, " illegal index %d for length %d " , index , _len );
266
266
if (index < --_len) {
267
267
// Replace removed element with last one.
268
268
_data[index ] = _data[_len];
@@ -390,7 +390,7 @@ class GrowableArrayWithAllocator : public GrowableArrayView<E> {
390
390
void push (const E& elem) { append (elem); }
391
391
392
392
E at_grow (int i, const E& fill = E()) {
393
- assert (0 <= i, " negative index" );
393
+ assert (0 <= i, " negative index %d " , i );
394
394
if (i >= this ->_len ) {
395
395
if (i >= this ->_max ) grow (i);
396
396
for (int j = this ->_len ; j <= i; j++)
@@ -401,7 +401,7 @@ class GrowableArrayWithAllocator : public GrowableArrayView<E> {
401
401
}
402
402
403
403
void at_put_grow (int i, const E& elem, const E& fill = E()) {
404
- assert (0 <= i, " negative index" );
404
+ assert (0 <= i, " negative index %d " , i );
405
405
if (i >= this ->_len ) {
406
406
if (i >= this ->_max ) grow (i);
407
407
for (int j = this ->_len ; j < i; j++)
@@ -413,7 +413,7 @@ class GrowableArrayWithAllocator : public GrowableArrayView<E> {
413
413
414
414
// inserts the given element before the element at index i
415
415
void insert_before (const int idx, const E& elem) {
416
- assert (0 <= idx && idx <= this ->_len , " illegal index" );
416
+ assert (0 <= idx && idx <= this ->_len , " illegal index %d for length %d " , idx, this -> _len );
417
417
if (this ->_len == this ->_max ) grow (this ->_len );
418
418
for (int j = this ->_len - 1 ; j >= idx; j--) {
419
419
this ->_data [j + 1 ] = this ->_data [j];
@@ -423,7 +423,7 @@ class GrowableArrayWithAllocator : public GrowableArrayView<E> {
423
423
}
424
424
425
425
void insert_before (const int idx, const GrowableArrayView<E>* array) {
426
- assert (0 <= idx && idx <= this ->_len , " illegal index" );
426
+ assert (0 <= idx && idx <= this ->_len , " illegal index %d for length %d " , idx, this -> _len );
427
427
int array_len = array->length ();
428
428
int new_len = this ->_len + array_len;
429
429
if (new_len >= this ->_max ) grow (new_len);
0 commit comments