Skip to content

Commit 783199c

Browse files
committed
fix return value of range eraser in Vector
1 parent 8ad9ae8 commit 783199c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

inst/include/Rcpp/vector/Vector.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -894,13 +894,13 @@ class Vector :
894894
iterator target_it = target.begin() ;
895895

896896
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
897-
iterator result ;
897+
int result = 0;
898898
if( Rf_isNull(names) ){
899899
int i=0;
900900
for( ; it < first; ++it, ++target_it, i++ ){
901901
*target_it = *it ;
902902
}
903-
result = begin() + i + 1 ;
903+
result = i;
904904
for( it = last ; it < this_end; ++it, ++target_it ){
905905
*target_it = *it ;
906906
}
@@ -911,7 +911,7 @@ class Vector :
911911
*target_it = *it ;
912912
SET_STRING_ELT( newnames, i, STRING_ELT(names, i ) );
913913
}
914-
result = begin() + i + 1 ;
914+
result = i;
915915
for( it = last ; it < this_end; ++it, ++target_it, i++ ){
916916
*target_it = *it ;
917917
SET_STRING_ELT( newnames, i, STRING_ELT(names, i + nremoved ) );
@@ -920,7 +920,7 @@ class Vector :
920920
}
921921
Storage::set__( target.get__() ) ;
922922

923-
return result ;
923+
return begin() + result;
924924

925925
}
926926

0 commit comments

Comments
 (0)