Skip to content

Commit acbfc21

Browse files
committed
Merge pull request #173 from yixuan/erasereturn
fix return value of range eraser in Vector
2 parents 68f4bf2 + 783199c commit acbfc21

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
@@ -895,13 +895,13 @@ class Vector :
895895
iterator target_it = target.begin() ;
896896

897897
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
898-
iterator result ;
898+
int result = 0;
899899
if( Rf_isNull(names) ){
900900
int i=0;
901901
for( ; it < first; ++it, ++target_it, i++ ){
902902
*target_it = *it ;
903903
}
904-
result = begin() + i + 1 ;
904+
result = i;
905905
for( it = last ; it < this_end; ++it, ++target_it ){
906906
*target_it = *it ;
907907
}
@@ -912,7 +912,7 @@ class Vector :
912912
*target_it = *it ;
913913
SET_STRING_ELT( newnames, i, STRING_ELT(names, i ) );
914914
}
915-
result = begin() + i + 1 ;
915+
result = i;
916916
for( it = last ; it < this_end; ++it, ++target_it, i++ ){
917917
*target_it = *it ;
918918
SET_STRING_ELT( newnames, i, STRING_ELT(names, i + nremoved ) );
@@ -921,7 +921,7 @@ class Vector :
921921
}
922922
Storage::set__( target.get__() ) ;
923923

924-
return result ;
924+
return begin() + result;
925925

926926
}
927927

0 commit comments

Comments
 (0)