Note: I'm using jGrasp and writing C++
I'm supposed to create a "remove" function based off of the following postcondition:
"The current item has been removed from the sequence, and the item after this (if there is one) is now the new current item."
I'm aware that one cannot simply remove an element from an array, leaving the position unoccupied, but is it possible to shift the elements in the array to the left in such a way that the succeeding element 'overwrites' the preceding element?
For example, |1|2|3|4|... --> |1|2|4|..., where '4' replaces '3'
I'm supposed to create a "remove" function based off of the following postcondition:
"The current item has been removed from the sequence, and the item after this (if there is one) is now the new current item."
I'm aware that one cannot simply remove an element from an array, leaving the position unoccupied, but is it possible to shift the elements in the array to the left in such a way that the succeeding element 'overwrites' the preceding element?
For example, |1|2|3|4|... --> |1|2|4|..., where '4' replaces '3'
Comment