Mission Base

Program Base Library Functions

PblList* pblListCloneRange

( PblList* list,
  int fromIndex,
  int toIndex )

Returns a shallow copy from this list of all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.

Documentation

Returns a shallow copy from this list of all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.

For array lists cloning has a time complexity of O(M), with M being the number of elements cloned.

For linked lists cloning from the beginning or the end of the list has a time complexity of O(M) with M being the number of elements cloned, while cloning from a random position in the middle of the list has a time complexity of O(N) with N being the number of elements in the list.

This method has a memory complexity of O(M), with M being the number of elements cloned.

Parameters:
list - The list to use
fromIndex - The index of first element to be cloned.
toIndex - The index after last element to be cloned.
Returns:
PblList * retPtr != NULL: A pointer to the new list.
PblList * retPtr == NULL: An error, see pbl_errno:
PBL_ERROR_OUT_OF_MEMORY - Out of memory.
PBL_ERROR_OUT_OF_BOUNDS - fromIndex is out of range (fromIndex < 0 || fromIndex >= size()) or toIndex is out of range ( toIndex < 0 || toIndex > size()) or range is negative.

Alphabetic index



This page was generated with the help of DOC++.