Vector_remove

Vector_remove

Homepage Containers

Destroys the element stored at the specific position in the Vector object, and removes it.

Result := Vector_remove(VectorObject, index)

Parameters

VectorObject The Vector object to use for the current operation.
index Index of element to remove.

Return Value

True (1) if the previous object was destroyed,
False (0) if the new object is the same as the old,
or a negative number, the lock count (as a negative), if the previous object still exists (see remarks).

Remarks

If VectorObject is NULL (0 or blank), the empty string is returned, to indicate an error.

When removing an object, the previous object is destroyed. Call Vector_discard, instead, if you wish to only discard the previous object. The object will not be destroyed if the lock count for the element is more than one. In this case, the lock count will be decreased by one, and Result will be the negative of the new lock count. So, if Result < 0, -Result is the lock count for the previous object.

Index values start at 1 and "wrap".

Related

Vector_get, Vector_getAddress

Vector_set, Vector_replace, Vector_discard

Vector

Examples

;Creates a new Vector with the default parameters.
myVector := Vector_new()

;Adds a String object to myVector.
aString := String_new("Hello World!")
Vector_add(myVector, aString)

;Destroys the last object, and removes it.
Vector_remove(myVector, 0)

Homepage  |  Containers