Vector Class (Collection)
The Vector class allows you to create a collection of data elements referenced by an index (zero-based). Data elements may be inserted, read, and deleted from anywhere within the collection.
An element is added to the vector collection several ways: using insert(iIndex, oElement) to add the element in front of the iIndex element. where oElement is the data to be added, or using push_back(oElement) to add the element to the end of the collection.
myVectorObj.insert(iIndex, oElement); //adds oElement at position iIndex in the collection
myVectorObj.push_back(oElement); //adds oElement as the last element of the collection
Elements are read from the vector using square brackets [iIndex] that specify the index of the element to read. Elements are written to the vector using square brackets [iIndex] to place oElement in an existing iIndex position.
Plot1(myVectorObj[iIndex].tostring()); // displays oElement at iIndex as a string
myVectorObj[iIndex] = myInput; //replaces oElement at element iIndex, overwriting content
Elements are removed from the vector using the Erase(iIndex) to remove the iIndex element of the collection or by using pop_back() to remove the last element in the collection.
myVectorObj.erase(iIndex); //removes element at iIndex
myVectorObj.pop_back(); //removes element at end of collection
Namespace: elsystem.collections