Hi guys I wrote a function to find the highest number in an array and a vector,it should work on both,
when I use the [] operator to pass in my data it works fine no run time exceptions
but when I use .at() function for std::vector it throws an out of range exception
how come std:vector operator[] does not throw an exception if you refer past the size of the vector but when you use the .at() function it throws an exception,
The .at() function validates the index and throws an exception if it is out of bounds.
operator[] doesn't do any bounds checking. If the index is out of bounds the behaviour is simply undefined (which means there are no guarantees what will happen).