Updated the bracket operator overload to resize the array if the given index is too large.