I noticed today that std::vector::at()
is significantly slower than accessing values with square brackets []
. According to the doc .at()
is safer because it won't let me access values beyond the bounds of the array. However, even if I access out of bound values with at()
, I'll obviously still have an error, so that's something I need to avoid no matter what.
So is there any good reason why anyone would use at()
instead of []
?