Vector
operator[] (int i) [Vector template]
Peek at item i
in the vector (zero-based) using operator[]
instead of at()
. Only call this if the item exists.
When used on the left side an expression, sets the value at that location. The array must already contain that element; you cannot increase the size of the array using operator[].
// PROTOTYPES
T& operator[](int i);
const T& operator[](int i) const;
// EXAMPLE
Vector<int> v({123, 456, 789});
Log.info("%d", v[0]);
v[0] = 999;